Import Javafx Can Not Be Resolved
I Am Using Windows 10 64-Bit and Eclipse Java 2019-06. I Have Installed Jdk 12.0.2 and Jre 8U221. I Have Set Environment System Path in Environment Variable to...
I am using Windows 10 64-bit and eclipse java 2019-06.I have installed jdk 12.0.2 and jre 8u221. I have set environment system path in environment variable to C:\Program Files\Java\jdk-12.0.2\bin.I can easily compile and run java file in windows command prompt. I can not import javafx.
I have used e(fx)clipse (javafx1 in the following picture). I have also tried adding jfxswt.jar into external library(javafx2 in the following picture).
2 Answers
As per this article, Future of JavaFx
Starting with JDK 11, Oracle is making JavaFX easier to adopt by making the technology available as a separate download, decoupled from the JDK.
As you mentioned, you are using JDK 12.0.2. JavaFx library are no longer part of JDK, they need to be added separately.
Here you can find official documentation on how to proceed with JavaFX 12 development
Install JavaFx
JFX is not part of JDK since Java 11. They are now distributed as standalone packages. Some reading can be found here
You can either add the OpenJFX libraries by downloading them from here, or you can use another JDK distribution such as Azul, which bundles the OpenJFX with their OpenJDK distributions.