Deploying JavaFX 11 Desktop Applications with a JRE
JavaFX 11 has removed the Web Start deployment option available in Java 8. To continue deploying applications with bundled JREs, developers need to follow a more modular approach.
Building the Application
-
Create a module descriptor: Declare the application module with its dependencies in a module-info.java file.
-
Compile with module path: Use --module-path to specify the module dependencies during compilation.
-
Create JAR: Build a modular JAR by compiling the classes and packaging them into a JAR file.
-
Convert JAR to JMOD: Create a JMOD (Java Module) file using the jmod tool, specifying dependencies and the main class.
Creating the Image
-
Link JMODs: Use jlink to link the application JMOD and its dependencies into an image.
-
Create Launcher Executable: Specify a launcher executable name using --launcher to simplify execution.
Distributing the Application
-
Package the Image: Distribute a ZIP or TAR.GZ containing the image tree, including the launcher executable.
-
Create Native Installer (Optional): Use jpackage to create native installers for different platforms.
Cross-Building for Different Platforms
-
Acquire JDKs: Obtain JDKs for target platforms and extract them to separate directories.
-
Specify Target Platform: Pass the target platform to jmod and jlink using --target-platform option.
-
Include External JDK JMODs: Explicitly include the JMODs of the foreign JDK using --module-path.
The above is the detailed content of How Can I Deploy JavaFX 11 Desktop Applications with a Bundled JRE?. For more information, please follow other related articles on the PHP Chinese website!