JEP draft: Packaging Tool

OwnerKevin Rushforth
TypeFeature
ScopeJDK
StatusDraft
Componentdeploy / packager
Discussioncore dash libs dash dev at openjdk dot java dot net
EffortM
DurationM
Relates toJEP 311: Java Packager API & CLI
Reviewed byAlexander Matveev, Alexey Semenyuk, Andy Herrick, Kevin Rushforth, William Harnois
Created2018/04/04 19:22
Updated2018/06/01 14:04
Issue8200758

Summary

Create a new tool, jpackager, for packaging Java run-time images and self-contained Java server or client applications.

Goals

Create a simple packaging tool, based on the existing javapackager, to generate the following types of native packages:

The tool should provide the following features:

Developers should be able to access the tool either by running the jpackager executable or by using the ToolProvider API.

Non-Goals

Motivation

Application developers are accustomed to packaging up their applications in a format that can be installed or executed on their native platform. The existing packaging tool, javapackager, is currently part of OpenJFX. It has been distributed with the Oracle JDK since JDK 8, and was enhanced in JDK 9 to enable bundling applications with custom run-time images. JavaFX, including javapackager, will be removed in JDK 11, leaving a gap for developers now accustomed to using the javapackager.

There is also a need for tool that supports packaging up a Java Runtime, such as a JDK or server JRE, that can be installed on a target system.

The new jpackager tool will fill this gap by providing the ability to create packages for applications or a server JRE. Since this will be a new tool, we will take the opportunity to clean up the existing javapackager API and command-line interface to remove deprecated or unsupported options and to conform to JEP 293.

Description

The new jpackager tool will be delivered in a new jdk.packager module as part of the JDK. This new tool will be based on the existing javapackager tool, with all features related to Java Web Start and JavaFX excluded. The command-line interface (CLI) will be reworked according to JEP 293: Guidelines for JDK Command-Line Tool Options. In addition to the command-line interface, jpackager will be accessible via the ToolProvider API under the name "jpackager".

The tool will provide support for several formats of application "bundles" that include all necessary Java dependencies. The basic is an application image that is stored in a single directory in the filesystem and can include following:

This image can be redistributed as is, or as an installable package (for example, msi or dmg format). If a user does not specify a filesystem location during the installation process then the default location for the application will be the typical default for each platform (for example, on Linux it will be /usr/bin). When the application is started, the launcher will read the configuration files and launch the embedded Java run-time image with the specified arguments.

If no custom run-time image is provided, the tool will run jlink to create a server JRE as the runtime image for the package.

jpackager will perform the following steps to generate a package, given a Java run-time image:

Additional features:

The following "optional" features might be nice to include if there is time to do so: