3

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

enter image description here

user11862325
  • 73
  • 1
  • 1
  • 7

2 Answers2

5

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

Shrikant Havale
  • 1,250
  • 1
  • 16
  • 36
2

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.

RKrum
  • 410
  • 5
  • 15