Adding Maven Preventing JavaFX from Compiling
Hi, I was wondering if anyone could help me with a problem I've encountered.
I have been using JavaFX to create my project, with the FXML file, controller and main classes all in the same package. I needed to use the GSON library therefore selected 'Maven' from 'Add Framework support', then adding the GSON dependency, however as soon as I did this it prevents the code from compiling and says that none of the JavaFX libraries exist, even though it worked just 1 second before:
Information:java: Errors occurred while compiling module 'tech-solution'
Information:javac 8 was used to compile java sources
Information:26/07/2018 12:02 - Compilation completed with 49 errors and 3 warnings in 3 s 867 ms
Warning:java: source value 1.5 is obsolete and will be removed in a future release
Warning:java: target value 1.5 is obsolete and will be removed in a future release
Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.
C:\Users\adaml\Google Drive\School Work and Revision\Computer Science\Coursework\tech-solution\src\main\java\app\Controller.java
Error:(3, 19) java: package javafx.fxml does not exist
Error:(4, 28) java: package javafx.scene.control does not exist
Error:(5, 28) java: package javafx.scene.control does not exist
Error:(6, 28) java: package javafx.scene.control does not exist
Error:(7, 28) java: package javafx.scene.control does not exist
Error:(8, 20) java: package javafx.stage does not exist
Error:(13, 36) java: cannot find symbol
symbol: class Initializable
Error:(15, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(16, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(17, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(18, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(19, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(20, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(21, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(22, 11) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(23, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(24, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(25, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(26, 11) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(28, 12) java: cannot find symbol
symbol: class Button
location: class app.Controller
Error:(29, 12) java: cannot find symbol
symbol: class MenuBar
location: class app.Controller
Error:(15, 31) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(16, 32) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(17, 35) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(18, 31) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(19, 36) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(20, 34) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(21, 34) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(22, 36) java: cannot find symbol
symbol: class MenuItem
location: class app.Controller
Error:(23, 28) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(24, 27) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(25, 28) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(26, 30) java: cannot find symbol
symbol: class Menu
location: class app.Controller
Error:(29, 38) java: cannot find symbol
symbol: class MenuBar
location: class app.Controller
Error:(53, 9) java: cannot find symbol
symbol: class Stage
location: class app.Controller
Error:(53, 24) java: cannot find symbol
symbol: class Stage
location: class app.Controller
C:\Users\adaml\Google Drive\School Work and Revision\Computer Science\Coursework\tech-solution\src\main\java\app\Main.java
Error:(3, 26) java: package javafx.application does not exist
Error:(4, 19) java: package javafx.fxml does not exist
Error:(5, 20) java: package javafx.scene does not exist
Error:(6, 20) java: package javafx.scene does not exist
Error:(7, 20) java: package javafx.stage does not exist
Error:(9, 27) java: cannot find symbol
symbol: class Application
Error:(12, 23) java: cannot find symbol
symbol: class Stage
location: class app.Main
Error:(11, 5) java: method does not override or implement a method from a supertype
Error:(14, 9) java: cannot find symbol
symbol: class Parent
location: class app.Main
Error:(14, 39) java: cannot find symbol
symbol: method getClass()
location: class app.Main
Error:(14, 23) java: cannot find symbol
symbol: variable FXMLLoader
location: class app.Main
Error:(16, 35) java: cannot find symbol
symbol: class Scene
location: class app.Main
Error:(23, 9) java: cannot find symbol
symbol: method launch(java.lang.String[])
location: class app.Main
Afterwards, I followed this: https://stackoverflow.com/questions/30488223/how-to-create-a-javafx-maven-project-in-intellij-idea guide here which said to add a plugin to maven and move the FXML file under resources, but the error still occurs. I also created a brand new JavaFX program with maven and the error still occurs. Can anyone help on this?
Please sign in to leave a comment.
This is up to JavaFX/Maven configuration and is not IntelliJ IDEA specific. https://stackoverflow.com/ is your best place to get help with this issue.
You can verify that it's not IntelliJ IDEA specific by building it in the command line Maven.