Name
jpackage - tool for packaging self-contained Java applications.
Synopsis
jpackage [options]
- options
- Command-line options separated by spaces. See jpackage Options.
Description
The jpackage tool will take as input a Java application and a Java run-time image, and produce a Java application image that includes all the necessary dependencies. It will be able to produce a native package in a platform-specific format, such as an exe on Windows or a dmg on macOS. Each format must be built on the platform it runs on, there is no cross-platform support. The tool will have options that allow packaged applications to be customized in various ways.
jpackage Options
Generic Options:
@filenameRead options and/or mode from a file.
This option can be used multiple times.
--typeor-ttype stringThe type of package to create
Valid values are: {"app-image", "exe", "msi", "rpm", "deb", "pkg", "dmg"}
If this option is not specified a platform dependent default type will be created.
--app-versionversionVersion of the application and/or package`
--copyrightcopyright stringCopyright for the application.
--descriptiondescription stringDescription of the application.
--helpor-hPrint the usage text with a list and description of each valid option for the current platform to the output stream, and exit.
--nameor-nnameName of the application and/or package.
--destor-doutput pathPath where generated output file is placed
Defaults to the current working directory. (absolute path or relative to the current directory).
--tempfile pathPath of a new or empty directory used to create temporary files (absolute path or relative to the current directory).
If specified, the temp dir will not be removed upon the task completion and must be removed manually.
If not specified, a temporary directory will be created and removed upon the task completion.
--vendorvendor stringVendor of the application.
--verboseEnables verbose output.
--versionPrint the product version to the output stream and exit.
Options for creating the runtime image:
--add-modulesmodule name [,module name...]A comma (",") separated list of modules to add.
This module list, along with the main module (if specified) will be passed to jlink as the --add-module argument. If not specified, either just the main module (if --module is specified), or the default set of modules (if --main-jar is specified) are used.
This option can be used multiple times.
--module-pathor-pmodule path...A File.pathSeparator separated list of paths.
Each path is either a directory of modules or the path to a modular jar, and is absolute or relative to the current directory.
This option can be used multiple times.
--bind-servicesPass on --bind-services option to jlink (which will link in service provider modules and their dependences).
--runtime-imagefile pathPath of the predefined runtime image that will be copied into the application image (absolute path or relative to the current directory).
If --runtime-image is not specified, jpackage will run jlink to create the runtime image using options: --strip-debug, --no-header-files, --no-man-pages, and --strip-native-commands.
Options for creating the application image:
--iconicon file pathPath of the icon of the application bundle (absolute path or relative to the current directory).
--inputor-iinput pathPath of the input directory that contains the files to be packaged (absolute path or relative to the current directory).
All files in the input directory will be packaged into the application image.
Options for creating the application launcher(s):
--add-launcherlauncher name=file pathName of launcher, and a path to a Properties file that contains a list of key, value pairs (absolute path or relative to the current directory).
The keys "module", "add-modules", "main-jar", "main-class", "arguments", "java-options", "app-version", "icon", and "win-console" can be used.
These options are added to, or used to overwrite, the original command line options to build an additional alternative launcher. The main application launcher will be built from the command line options. Additional alternative launchers can be built using this option, and this option can be used multiple times to build multiple additional launchers.
--argumentsmain class argumentsCommand line arguments to pass to the main class if no command line arguments are given to the launcher.
This option can be used multiple times.
--java-optionsjava optionsOptions to pass to the Java runtime.
This option can be used multiple times.
--main-classclass nameQualified name of the application main class to execute.
This option can only be used if --main-jar is specified.
--main-jarmain jar fileThe main JAR of the application; containing the main class (specified as a path relative to the input path).
Either --module or --main-jar option can be specified but not both.
--moduleor-mmodule name/main class]The main module (and optionally main class) of the application This module must be located on the module path.
When this option is specified, the main module will be linked in the Java runtime image. Either --module or --main-jar option can be specified but not both.
Platform dependent option for creating the application launcher:
Windows platform options (available only when running on Windows):
--win-consoleCreates a console launcher for the application, should be specified for application which requires console interactions
macOS platform options (available only when running on macOS):
--mac-package-identifierID stringAn identifier that uniquely identifies the application for macOSX.
Defaults to the the main class name.
May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters.
--mac-package-namename stringName of the application as it appears in the Menu Bar.
This can be different from the application name.
This name must be less than 16 characters long and be suitable for displaying in the menu bar and the application Info window. Defaults to the application name.
--mac-bundle-signing-prefixprefix stringWhen signing the application bundle, this value is prefixed to all components that need to be signed that don't have an existing bundle identifier.
--mac-signRequest that the bundle be signed.
--mac-signing-keychainfile pathPath of the keychain to search for the signing identity (absolute path or relative to the current directory).
If not specified, the standard keychains are used.
--mac-signing-key-user-nameteam nameTeam name portion in Apple signing identities' names.
For example "Developer ID Application:
"
Options for creating the application package:
--app-imagefile pathLocation of the predefined application image that is used to build an installable package (absolute path or relative to the current directory).
See create-app-image mode options to create the application image.
--file-associationsfile pathPath to a Properties file that contains list of key, value pairs (absolute path or relative to the current directory).
The keys "extension", "mime-type", "icon", and "description" can be used to describe the association.
This option can be used multiple times.
--install-dirfile pathAbsolute path of the installation directory of the application on OS X or Linux. Relative sub-path of the installation location of the application such as "Program Files" or "AppData" on Windows.
--license-filefile pathPath to the license file (absolute path or relative to the current directory).
--resource-dirpathPath to override jpackage resources (absolute path or relative to the current directory).
Icons, template files, and other resources of jpackage can be over-ridden by adding replacement resources to this directory.
--runtime-imagefile-pathPath of the predefined runtime image to install (absolute path or relative to the current directory).
Option is required when creating a runtime installer.
Platform dependent options for creating the application package:
Windows platform options (available only when running on Windows):
--win-dir-chooserAdds a dialog to enable the user to choose a directory in which the product is installed.
--win-menuAdds the application to the system menu.
--win-menu-groupmenu group nameStart Menu group this application is placed in.
--win-per-user-installRequest to perform an install on a per-user basis.
--win-shortcutCreates a desktop shortcut for the application.
--win-upgrade-uuidid stringUUID associated with upgrades for this package.
Linux platform options (available only when running on Linux):
--linux-package-namepackage nameName for Linux package, defaults to the application name.
--linux-deb-maintaineremail addressMaintainer for .deb bundle.
--linux-menu-groupmenu-group-nameMenu group this application is placed in.
--linux-package-depsRequired packages or capabilities for the application
--linux-rpm-license-typetype stringType of the license ("License:
" of the RPM .spec). --linux-app-releaserelease stringRelease value of the RPM
.spec file or Debian revision value of the DEB control file. --linux-app-categorycategory stringGroup value of the RPM
.spec file or Section value of DEB control file. --linux-shortcutCreates a shortcut for the application
jpackage Examples
Generate an application package suitable for the host system:
For a modular application:
jpackage -n name -p modulePath -m moduleName/className
For a non-modular application:
jpackage -i inputDir -n name \
--main-class className --main-jar myJar.jar
From a pre-built application image:
jpackage -n name --app-image appImageDir
Generate an application image:
For a modular application:
jpackage --type app-image -n name -p modulePath \
-m moduleName/className
For a non-modular application:
jpackage --type app-image -i inputDir -n name \
--main-class className --main-jar myJar.jar
To provide your own options to jlink, run jlink separately:
jlink --output appRuntimeImage -p modulePath -m moduleName \
--no-header-files [<additional jlink options>...]
jpackage --type app-image -n name \
-m moduleName/className --runtime-image appRuntimeImage
Generate a Java runtime package:
jpackage -n name --runtime-image <runtime-image>