How to build jar file from JavaFX app?
已回答
When I build a jar file of a (working in the IDE) JavaFX app, I get this error when trying to start it with java -jar jarfile.jar:
"Error: JavaFX runtime components are missing, and are required to run this application"
I have tried adding the dlls from C:\Program Files\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\bin to the jar, but it results in the same error.
I also tried adding the dlls from ~\.openjfx\cache\17.0.2-ea (which I assume is the JavaFX SDK IntelliJ uses?) to the jar instead, but this gives me the same result.
Several tutorials I found say that this is how it should work, but I am obviously not clever enough.
What am I doing wrong?
The app works when run inside IntelliJ.
请先登录再写评论。
After the JDK8, the JDK doesn't include the JavaFX related library, so you can't run your export jar directly. Please see https://openjfx.io/openjfx-docs/#modular on how to create a native image to run it