I have a new pc, I have installed inteliJ with JDK and JRE 9.0.1. I also installed SceneBuilder 9.0.1. I have copied the project that I had on old pc and when I run it I get this error: Error:(3, 26) java: package javafx.application does not exist. Do I need to install something else that contains this package? Thank you.
If this is your case also, you can do fix this by simply right-clicking on the javaFX project folder-> Build Path-> Configure Build Path-> Select JavaFX SDK-> Remove library-> Select classpath -> add library-> user library-> select library-> apply. Save this answer.
To prevent an exception when working with JavaFX in IntelliJ, use JavaFX modules. You can add JavaFX modules as VM options in IntelliJ IDEA. You can prevent the failure from happening by setting the root on FXMLLoader before you load your FXML file.
The project doesn't support the JavaFX syntax. We need to export the JavaFX jar files to the project in order to run the JavaFX application. Just Right click on the project and select properties from the options. Go to Java Build Path → Libraries.
Or you can download the JavaFX/OpenJFX libraries, placing them in a folder where they will be detected by Java, “on the classpath” as we say. Java 16 and JavaFX/OpenJFX 16 are current, but both are only supported until their versions 17 arrives later this year in September 2021.
The JavaFX package is not included in JDK 9 and later. You need to install JDK 8, or you can add the JavaFX package separately, for example, from JDK 8 (jfxrt.jar
).
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