How To Deploy JAR, exe and msi for JavaFX 17 Application on Windows 11 x64

preview_player
Показать описание
In this tutorial, I will show you how to use the JPackage to produce a self-contained JavaFX or Java 17 application includes all the necessary dependencies. It allows us to produce a native package in an exe or msi on Windows 11 x64.

The tool has options that allow packaged applications to be customized in various ways.

--type
The type of package to create

--input
Path of the input directory that contains the files to be packaged

--dest
Path where generated output file is placed

--main-jar
The main JAR of the application containing the main class

--main-class
Qualified name of the application main class to execute.

--module-path
The path to modular jars

--add-modules
Add list of modules

--win-shortcut
Creates a desktop shortcut for the application.

--win-menu
Adds the application to the system menu.

--description
Description of the application

--app-version
Version of the application and/or package

--verbose
Enables verbose output

--icon
Path of the icon of the application package

You should download and install the following:

The Installed directories are as follow:

C:\Program Files\Java\jdk-17.0.1
C:\Program Files\Java\javafx-sdk-17.0.1
C:\Program Files\Java\javafx-jmods-17.0.1
C:\Users\Ken\AppData\Local\SceneBuilder
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3
C:\Program Files (x86)\WiX Toolset v3.11

VM options:
--module-path "C:\Program Files\Java\javafx-sdk-17.0.1\lib"

JDK 17.0.1
JavaFX 17.0.1
JavaFX SceneBuilder 17.0.0
IntelliJ IDEA 2021.3
Windows 11 x64

JPackage command:

Source:
Рекомендации по теме
Комментарии
Автор

Thanks man, that solved a problem that cost me a lot of time in the last 3 days

PedroHenrique-oium
Автор

Thanks for this sir it has answer many questions for me but what about adding external jar like mysql.jar

mbuguanjane
Автор

Hi, thanks for your tutorial, I got it working, except my IntelliJ didn't put main class in the manifest in jar so I had to do it manually
I have a question: now that java SDK and JRE is integrated, so for java 17, I should install the JDK to run the jar but not the JRE, does it mean it is harder for users to use the correct version? normally people just install the jre instead of jdk

chit
Автор

Does this Package takes all the dependencies (jssc, crud etc..) with it? Thx. And What about to pack a jre to the final client? This method provided it?

ecorodri
Автор

i'm trying to deploy my javafx application to an install exe with win10 64x, i allways have the same issus jpackage is not a command...
i don't know how to fix that

taharbouyoucef
Автор

When I try to run exe file, I get the next error message "Failed to launch JVM". I am using JDK19 and JavaFX19 any idea?

newuser
Автор

For what we need WiX Toolset? In this tutorial you have installed it but not used it.

zbigniewharasimowicz