Strange compilation problem in IntelliJ Community Edition

Answered

Greetings:

   I am using IntelliJ Community Edition (Version 16) to develop a JavaFX project, and I am seeing some strange compilation errors. According to the compiler, there are a number of JavaFX components that it cannot find.

 

   Upon checking out the mssing references, I discovered that they are all components that are in the package javafx.scene.control. It appears that these particular controls are the relatively new Dialog and Alert boxes that are in the latest JavaFX version.

   What is strange about this is that I checked the version of the JavaFX library I am compiling with. The controls in javafx.scene.control are part of the classpath and are supposed to be included in the compilation. For some reason, unfortunately, they are not being included.

   Because I use multiple IDEs, I created an Eclipse version of my project and compiled it usimg Eclipse. I had no compilation problems at all. Yet for some reason, the latest IntelliJ cannot find that specific package and fails to compile even though I am using the same IDE, the same JVM, and the same version of JavaFX!

   Has anyone seen this problem? Does anyone have some idea what is causing this behavior? Most importantly: can anyone give some idea how to fix this problem? 

 

   Someone please advise.

1 comment
Comment actions Permalink
Official comment

Hello Robert,

Thank you for your question.

This looks like a classpath issue.
As the classes not found by the compiler have been added in Java 8 update 40, the first thing you need to check is the JDK configuration.

Could you please make sure that the JDK used in your project is 8u40 or newer, the JavaFX runtime (jre/lib/ext/jfxrt.jar) is listed in JDK's jars, and the module configuration inherits or specifies that JDK.

Project SDK:

Module SDK:



Please sign in to leave a comment.