Home >Java >javaTutorial >How Can I Deploy a JavaFX 11 Desktop Application with a Bundled JRE?

How Can I Deploy a JavaFX 11 Desktop Application with a Bundled JRE?

Susan Sarandon
Susan SarandonOriginal
2024-12-01 12:04:18614browse

How Can I Deploy a JavaFX 11 Desktop Application with a Bundled JRE?

Deploying a JavaFX 11 Desktop Application with a JRE

With Oracle's discontinuation of Java Web Start, JavaFX developers now face the challenge of finding an alternative deployment method for their applications. This article explores the technique of bundling a JavaFX 11 application with a JRE, providing a comprehensive solution for easy distribution and updates.

Steps Involved

The process involves converting the application into a module, linking it to required modules, and creating an image file tree containing executables for distribution.

1. Creating a Module Descriptor

The first step is to turn the application into a module by creating a module-info.java file with a unique module name.

2. Building the Application

Build the application using a module path instead of a classpath.

3. Creating a JMOD

Convert the JAR file into a JMOD using the JDK's jmod tool.

4. Linking the JMOD

Link the JMOD and its dependencies into an image file tree using the jlink command.

5. Distributing the Image

Zip or tar and distribute the entire image file tree. The executable can be found in the bin directory.

Cross-Building for Different Platforms

To create images for other platforms, use the --target-platform option with jmod and explicitly include the jmods directory of the target platform in jlink.

Considerations

Native Binaries: The image includes native binaries, so separate images must be created for each platform.

Alternative Deployment Options:

  • Deployment Toolkits: Consider using JWrapper or InstallAnywhere for added features and customization options.
  • Native Installers: Java 14 introduces the jpackage tool, which can create native installers for the image file tree.

The above is the detailed content of How Can I Deploy a JavaFX 11 Desktop Application with a Bundled JRE?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn