javaeclipsejavafxjavafx-11runnable-jar

Export a JavaFX project in eclipse to a runable jar


I need to send a project made by JavaFX SDK 16 and Java SE-15 using Eclipse to my friends, but when I try to export it, i'm getting surprised that Eclipse doesn't insert the VM arguments to the exported file : enter image description here

and as you know since JavaFX SDK 10, JavaFX libraries are not anymore part of the Java SE, so we need to tell Eclipse where to find them by VM arguments, in short words, these VM arguments are really important to run my program.

I already know that I can insert those arguments while using prompt command to open it, but is there a more simple way? just by clicking on the exported file ?


Solution

  • Your main problem is that you are trying to do something that does not make any sense. Runnable jars are not a proper distribution format for JavaFX applications for various technical reasons. The way to go is having a look at jpackage. That's the proper way of dealing with distribution nowadays. Otherwise your are just banging your head against a wall.

    Here is a good summary of all the options you have: https://stackoverflow.com/a/68823040/4262407