I am using Intellij Idea to compile a project that uses Maven dependencies and Intellij keeps telling me that my project has 50 something errors because JavaFX does not exist.
Intellij is not highlighting all the javafx dependencies in my code as errors, it is just that once I press the run and compile the program says that everything in JavaFX does not exists.
I tried to redownload the latest JDK (Java 9.0.1) and that did not fix it. I went into the Default Project Structure and Project Structure to make sure it was using the correct jdk and that did not fix the issue. All the jdks I am using seem to list the javafx packages as included in the project.
This is also only an issue for a particular project that I am working on with a friend. We may have to move over all our code into a new project, however I am not sure if that will fix anything.
Any suggestions?
The issue is with your project, not with IntelliJ IDEA. import javafx.fxml.*; The second problem is that you do not specify JavaFX modules to be used in the module dependencies. cScripts\scripts\cChompy\build.gradle.kts needs to be updated with something like this:
Also Java 8 is now obsolete. To use JavaFX with a recent Java version either use a Java distribution which includes JavaFX like Liberica, or follow the instructions for using JavaFX modules documented at openjfx.io.
Starting from versions after 8, JavaFX is allocated to a separate OpenJFX project, respectively, it is no longer supplied with the JDK. At one time, to run a project on JavaFX and OpenJDK 11, I drew information from hence You're wrong. JavaFX is not included in Oracle JDK 11, it must be installed separately.
For JavaFX applications, IntelliJ IDEA provides a dedicated artifact type: JavaFx Application. Packaging a JavaFX application in .jar is possible only with Java 8. IntelliJ IDEA creates the artifact for packaging the application together with the project.
I missed the modules in my gradle.build. Had to update
javafx {
version = "11"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
I had this problem after upgrading a JavaFX project from Java 8 to Java 9.
After checking the usual language level settings for the project and module in IntelliJ and the Maven pom, I found the problem was that the module was explicitly set to generate Java 8 bytecode in the Java Compiler preferences.
Look in Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler
. Check that Project bytecode version
is unset (or set correctly) and that your module is not listed in Per-module bytecode version
with an incorrect value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With