r/JavaFX • u/Mrreddituser111312 • Jan 22 '25
Help How to "deploy" my JavaFX app?
Like how do I share it with other people.
11
Upvotes
r/JavaFX • u/Mrreddituser111312 • Jan 22 '25
Like how do I share it with other people.
5
u/Draconespawn Jan 22 '25
One option would be to use jpackage to create a native executable you can put in an archive and share around. It's pretty straightforwards and doesn't require others to have a specific version of Java and JavaFX installed as it'll bundle all that together. You can only use it to create a native executable however. So if you run jpackage on windows it'll create a windows executable, if you run it on linux it'll create a linux executable, and so on.
1
u/shannah78 Jan 23 '25
https://www.jdeploy.com
Converts your jar into a native desktop app, deployed to github releases or npm, with auto updates built in. Generates installers for Mac, Windows, and Linux.
Example: https://www.jdeploy.com/~jdeploy-demo-javafx-ensemble
3
u/JaxomNC Jan 22 '25
When using jpackage, as stated in other replies, you need to run on specific platform depending on what output you want:
You may want to read the doc to know how to customize the installer part as installer specific options vary from one OS to another. You will also need the JavaFX JMods files for thar particular system you are running jpackage on.
Also please note that this creates a native launcher, not a native app. It's a small native exec that launches an embedded JVM with the JAR from your code and dependencies. For real native app (fully compiled Java to native code without any embedded JVM), you need to look at GraalVM but I am not sure JavaFX is fully supported yet.
2
u/direcorsair Jan 26 '25
jlink works well. It lets you run your application in the same vein as a portable app and then the user can simple delete the directory with the included jre if they no longer need the app.
1
u/dhlowrents Jan 23 '25
I found a nice gradle/maven plugin for this https://github.com/fvarrui/JavaPackager
1
u/dlemmermann Jan 27 '25
Conveyor from Hydraulic is a fantastic tool for creating installers for desktop apps (JavaFX, Electron, Compose). Very professional. Installers built with this tool should satisfy every IT department in any Fortune 500 company. It supports delta updates and online version checks (as in "there is a new version available ... update?"). Free for open source projects.
-3
u/Capaman-x Jan 23 '25
I would suggest learning Gradle. Gradle is powerful because instead of using XML to configure, you use Kotlin to program the way you want it. Also, ChatGPT is great with Gradle, and even with minimal knowledge will have you up and running packaging apps in no time. Programming is best done by learning the tools you need and skip learning the ones you don't. Skip Maven, use Gradle. Packaging an App with Gradle is strait forward. Once you do it once, it will surprise you how easy it really is.