Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:(3, 26) java: package javafx.application does not exist

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.

like image 784
LauCirco Avatar asked Nov 09 '17 09:11

LauCirco


People also ask

How do I fix JavaFX error?

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.

How do I fix the exception in the application start method in JavaFX?

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.

Why is JavaFX not working in Eclipse?

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.

Is JavaFX compatible with Java 16?

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.


1 Answers

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).

like image 133
Ivan Pozhidaev Avatar answered Oct 24 '22 01:10

Ivan Pozhidaev