InfoQ Homepage News Building Self-Contained, Installable Java Applications with JEP 343: Packaging Tool

Building Self-Contained, Installable Java Applications with JEP 343: Packaging Tool


The OpenJDK community has released an early access build of JEP 343: Packaging Tool. The tool, also known as jpackage, is a new utility for packaging self-contained Java applications along with a Java Runtime Environment. This prototype is based on the JavaFX javapackager tool and is intended for early-adopter developers who are interested in exploring jpackage.

Historicually, Java developers have desired the capability to build applications that can be installed on a native platform, rather than installing a Java Runtime Environment (JRE), distributing JAR files, and configuring the classpath. With jpackage, Java applications can be installed and uninstalled in a manner typical for a specific platform -- jpackage supports msi and exe formats on Windows, pkg and dmg on MacOS, and deb and rpm on Linux. 

The jpackage aims to fill gaps left out by other technologies, such as:

  • javapackager, a packaging tool distributed with the Oracle's JDK 8, which was removed from Oracle's JDK 11 as part of removing JavaFX
  • Java Web Start, which was deprecated in Java 9 along with Java Applet Viewer and JNLP, and removed from Oracle's JDK 11
  • pack200, a tool designed for compress jar files, which was deprecated in JDK 11 for removal in a future release

The jpackage tool supports: modular applications that have been linked with jlink into a custom runtime image; modular applications that are in modular JAR files or JMOD files; and legacy applications that run on the classpath, and are in one or more JAR files.

The output of jpackage is a Java application image that includes all necessary Java dependencies. The image is stored in a single directory in the filesystem and can include the following:

  • Native application launcher
  • Java runtime image, including the application modules if the application has been modularized
  • Application resources, such as jar, ico, png
  • Configuration files, such as plist, cfg, properties

The jpackage tool is planned to be part of the JDK 13 in a new jdk.jpackage module. The command-line interface (CLI) will conform to JEP 293: Guidelines for JDK Command-Line Tool Options. Furthermore, it is possible to access jpackage via the ToolProvider API (java.util.spi.ToolProvider) under the name "jpackage".

The jpackage command line interface

When running jpackage --help, a series of valuable information is displayed. Let's explore some of them.

The jpackage tool has two modes: create-image, which generates a platform-specific application image; and create-installer, which generates a platform-specific installer for the application.

For example, to generate a modular application image:

jpackage create-image --output outputdir --name AppName \
    --main-class package.ClassName -module moduleName -p modulePath
jpackage create-image --o outputdir -n AppName \
    -c package.ClassName -m moduleName -p modulePath

To generate a non-modular application image:

jpackage create-image --input inputdir --output outputdir \
    --name AppName --main-class package.ClassName --main-jar MyJar.jar
jpackage create-image -i inputdir -o outputdir -n AppName \
    -c package.ClassName -j MyJar.jar

To generate an application installer:

jpackage create-installer -i inputdir -o outputdir \
    -n  -c package.ClassName -j MyJar.jar
jpackage create-installer -o outputdir -n \

To generate a Java runtime installer:

jpackage create-installer --runtime-installer\
    --name  --output outputdir
jpackage create-installer --runtime-installer \
    -n  -o outputdir --runtime-image 

There are several other interesting things that are important to note regarding jpackage. For example, support is included for packaging Java applications such that they are suitable for submission to the Windows or MacOS app stores. Cross compilation will not be supported, and therefore Windows packages should be created by running the jpackage on Windows. Native splash screens and auto-update mechanisms will not be supported. Finally, the tool will not be available on Solaris platforms, Java Web Start application and JavaFX- specific features will not be supported, and there will be no GUI for the tool.

More details about jpackage can be found at the JEP 343: Packaging Tool page. Developers can download the early access build for the Windows, MacOS and Linux.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.