0

I am trying to deploy my JavaFX project (which uses Java 11). I found some other tips online that said to create a Launcher class which does not extend Application and call the actual main method from the Launcher class.

Although this allowed me to create a JAR that I could run in the desktop, it required me to provide a path to my JavaFX library folders in the command line.

Since I am deploying this project, I do not want to force users to have to download the entire JavaFX library.

Is there a way to deploy my JavaFX project without requiring users to have the entire JavaFX library folders downloaded? I am especially confused because it seems that the JAR already has the JavaFX library folders in it, as the JAR file size is large.

I would also like to avoid using any third-party libraries or tools.

For reference, I am using IntelliJ IDEA.

  • The best way would be to use JDK 14+ and package all the dependencies with your app. See https://github.com/dlemmermann/JPackageScriptFX . – CrazyCoder Jan 12 '21 at 20:50
  • Is there any way to do this without using any third-party libraries or tools? – javafx_questions Jan 12 '21 at 20:50
  • IntelliJ IDEA can't package JavaFX Java 11 application properly because fx:deploy tool was removed from the JDK: https://youtrack.jetbrains.com/issue/IDEA-200721. At least not until the IDE has its own packaging tool: https://youtrack.jetbrains.com/issue/IDEA-245551. – CrazyCoder Jan 12 '21 at 20:53
  • You may find https://stackoverflow.com/questions/53453212/how-to-deploy-a-javafx-11-desktop-application-with-a-jre helpful, though it uses plain JDK commands rather than IntelliJ. – VGR Jan 12 '21 at 23:20
  • Java's philosophy has changed with regards to deploying desktop applications. Now instead of expecting users to have Java installed and giving them an executable JAR file, the preferred approach is to package a self-contained application with an embedded JRE. You can do this with `jlink` (Java 9+). You can go even further and package your application so that it looks like a native executable or installer (that installs a native executable). This can be accomplished with `jpackage` (Java 14+). Both tools are part of the JDK. – Slaw Jan 13 '21 at 03:48
  • I am currently working with ```jlink```. I put everything into a module and I am following along with https://openjfx.io/openjfx-docs/#IDE-intellij. I got up to the ```jlink``` command part but for some reason, it keeps telling me that ``--output`` must be specified, even though I am providing a file path. – javafx_questions Jan 13 '21 at 04:16
  • Can you provide the full command you're using? Preferably in the question. – Slaw Jan 13 '21 at 12:04
  • Why don't you just follow the link in the first comment here? It tells you how to use jdeps, jlink and jpackage to do what you want and these are not third-party tools. – mipa Jan 13 '21 at 12:55

0 Answers0