Search code examples
javajavafxruntimeexception

JavaFX runtime exceptions when running .jar file


I have a JavaFX project running perfectly with no exceptions on eclipse IDE. I'm trying to export it into a runnable jar, and then an executable. However, after exporting it into a runnable jar I get multiple exceptions when I run it. These exceptions don't appear when I run the app inside eclipse. They only show up when I run the jar (via command prompt). Here are the exceptions:enter image description here

enter image description here

And here are my project files as well as the VM arguments used.

enter image description here


Solution

  • you need to add classpath you need java 15 in cmd use this in your cmd

    java --module-path "<path of your javafx lib" --add-modules ";javafx.fxml,javafx.controls" -jar jarfile.jar