I have a JavaFX project created on Intellij Community edition and JavaFX SDK 11.0.2. It works perfectly when I click the green run button on Intellij and the program opens up.
I was attempting to export it to a jar file and try to double click on it but nothing happens. I tried to open it on command line by doing java -jar myapp.jar
but it says "Error: JavaFX runtime components are missing, and are required to run this application".
This is how I created the jar file from the project.
- File -> Project Structure -> Artifacts -> click on the plus sign (+) -> Jar -> From modules with dependencies.
- Select the main class and OK. Followed by Clicking on the + sign and adding all files from the javafx bin folder to the File ( all the dll files).
- Go to Build -> Build artifacts -> Build. This generates the jar file but shows the above error.