JDK-8087496 : [IntelliJ] JavaFX application not initialized on FX app thread
  • Type: Bug
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2014-04-08
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
The attached JavaFX program runs correctly on Java 8 when launched from the command line, or run via the NetBeans or Eclipse IDEs. However, when run from the IntelliJ IDE, the following exception occurs:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:259)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Caused by: java.lang.IllegalStateException: Not on FX application thread; currentThread = main
    at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:210)
    at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:396)
    at javafx.scene.Scene.<init>(Scene.java:318)
    at javafx.scene.Scene.<init>(Scene.java:207)
    at TestStaticScene.<clinit>(TestStaticScene.java:13)
    ... 3 more
Comments
Note that this is an IntelliJ problem, so I plan to close this issue after filing it with JetBrains.
08-04-2014

This is happening because IntelliJ inserts their own "launcher" class, com.intellij.rt.execution.application.AppMain, that they pass to the Java launcher, and which in turn calls into the JavaFX application class. This defeats the Java launcher's ability to recognize a JavaFX program and initialize the JavaFX runtime.
08-04-2014