Intellij IDEA 2018.2 does not recognize the JavaFX packages with JDK 10

Viewed 13050

I have searched but not found any detailed information about it. In http://www.oracle.com/technetwork/java/javafx/downloads/index.html it says

As of JDK 7u6 JavaFX is included with the standard JDK and JRE bundles

But I am getting error on compile the code includes javafx.* packages. The packages are not founding. I am using Oracle JDK 10.0.2 and Intellij Idea 2018.2. Code is worked after I added the $JAVA8_HOME/jre/lib/ext/jfxrt.jar as library.

But the strange thing is I am able to build the code to target bytecode version 8 without adding the jar file from JDK 8 as above.

So the question is

How can I get the latest JavaFX?

Is the latest JavaFX is in the JDK 8?

UPDATE

JDK 10 includes JavaFX and compiled and ran successfully in command line. There is a problem with Intellij IDEA 2018.2. It does not recognize the JavaFX packages.

The error message in Intellij:

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

Note: There is no error while coding in editor (Not underling red). Error occurs when compiling in Intellij.

Updated question title.

2 Answers

JavaFX is included in Oracle JDK up to and including Java 10. From Java 11 onwards it will not be included anymore but can be downloaded separately here http://jdk.java.net/openjfx/ .

Additional information on how to get started with JavaFX from version 11 onwards is also available here: http://docs.gluonhq.com/javafx11/ .

Problem solved with this step:

Set the Project byte code version to 10 instead of 8 in

File > Settings > Build, Execution, Deployment > Compiler > Java Compiler

Thanks for helps.

Related