pfaco 0 Report post Posted March 24, 2016 Hello guys! I'm trying to compile a JavaFX-8 application using Excelsior JET. In the tab "TEST RUN" when clicking in "Run!" I receive the following message: The application has started with command line:java -cp "C:\temp\EletraMeterBench.jar;C:\Program Files (x86)\Java\jre1.8.0_73\lib\ext\jfxrt.jar" main/AppEletraDLMS --------------------------------------------------------------------------- Exception in thread "main" java.lang.ExceptionInInitializerError at gui.meter.GuiMeter.<init>(Unknown Source) at gui.meter.GuiMeter.getInstance(Unknown Source) at gui.Gui.<init>(Unknown Source) at gui.Gui.getInstance(Unknown Source) at main.Manager.<clinit>(Unknown Source) at main.AppEletraDLMS.<clinit>(Unknown Source) Caused by: java.lang.IllegalStateException: Toolkit not initialized at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source) at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source) at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(Unknown Source) at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(Unknown Source) at javafx.scene.control.Control.<clinit>(Unknown Source) ... 6 more --------------------------------------------------------------------------- The application has terminated with exit code: 1 I tried compiling and running the generated .exe, but the same error arrives. I didn't did any special configuration, and I'm wondering if I should? So far I couldn't get any information from google, forum, tutorials and documentation, so I hope to get an answer here! Anyone has any idea how to approach this? Thanks! Share this post Link to post Share on other sites
xappymah 0 Report post Posted March 25, 2016 I tried compiling and running the generated .exe, but the same error arrives. I didn't did any special configuration, and I'm wondering if I should? So far I couldn't get any information from google, forum, tutorials and documentation, so I hope to get an answer here! Anyone has any idea how to approach this? Thanks! Hello, Do I understand correctly that the same command line from the message works correctly when running with Oracle JRE 1.8.0_73? It is a known issue that Oracle JRE java launcher performs some JavaFX-specific "magic"-actions before launching the JavaFX application which can trigger the JavaFX initialization. However due to technical reasons Excelsior JET runtime doesn't perform such actions. But usually such problems don't happen if the JavaFX application is written in a proper way. According to the error message the problem happened during the class initialization of "main.AppEletraDLMS" class which caused initialization of a "GuiMeter" object. I suspect that initialization of "GuiMeter" object requires initialization of some JavaFX entities which expect that JavaFX is already initialized. However the "main.AppEletraDLMS" class initialization happened before execution of the main method which usually calls "launch()" method in JavaFX applications which initializes JavaFX. One of possible solutions is to avoid static initialization in "main.AppEletraDLMS" class and perform the initialization inside the "main". Another solution is to create an another class, like "main.Main" with a proper JavaFX main method which would only call "main.AppEletraDLMS"'s main method. So, it would ensure that JavaFX is already initialized when it is needed. Also, as I see you explicitly add "C:\Program Files (x86)\Java\jre1.8.0_73\lib\ext\jfxrt.jar" to your classpath. Actually this is redundant as since Java 8 JavaFX runtime is a part of JRE, i.e. you don't need to add jfxrt.jar to your classpath as it would be added anyway automatically. Best Regards, Ruslan Kim Excelsior Support Share this post Link to post Share on other sites