JPACKAGE(1)
π jpackage(1) β JDK Commands, but make it cute
πΈ NAME
jpackage β tool for packaging self-contained Java applications. Periodt.
β¨ SYNOPSIS
jpackage [options]
optionsβ Command-line options separated by spaces. See jpackage Options.
π¦ DESCRIPTION
Okay so picture this, bestie: jpackage takes a Java application and a Java runtime image as input, and produces a Java application image that includes all the necessary dependencies. Iconic behavior, honestly.
It can 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, no cap. The tool has options that allow packaged applications to be customized in various ways. Slay.
Real talk: each format must be built on the platform it runs on. There is no cross-platform support. Not me pretending otherwise π.
π JPACKAGE OPTIONS
π Generic Options:
@filenameβ Read options from a file. This option can be used multiple times.--typeor-ttype β The 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-versionversion β Version of the application and/or package.--copyrightcopyright β Copyright for the application.--descriptiondescription β Description of the application.--helpor-hβ Print the usage text with a list and description of each valid option for the current platform to the output stream, and exit.--iconpath β Path of the icon of the application package (absolute path or relative to the current directory).--nameor-nname β Name of the application and/or package.--destor-ddestination β Path where generated output file is placed (absolute path or relative to the current directory). Defaults to the current working directory.--tempdirectory β Path 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. So if you pass this one, bestie, cleanup is on you π«Ά--vendorvendor β Vendor of the application.--verboseβ Enables verbose output.--versionβ Print 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 tojlinkas the--add-moduleargument. If not specified, either just the main module (if--moduleis specified), or the default set of modules (if--main-jaris specified) are used. This option can be used multiple times.--module-pathor-pmodule-path [,module-path...]β AFile.pathSeparatorseparated 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.--jlink-optionsoptions β A space separated list of options to pass tojlink. If not specified, defaults to"--strip-native-commands --strip-debug --no-man-pages --no-header-files". This option can be used multiple times.--runtime-imagedirectory β Path of the predefined runtime image that will be copied into the application image (absolute path or relative to the current directory). If--runtime-imageis not specified,jpackagewill runjlinkto create the runtime image using options specified by--jlink-options.
π Options for creating the application image:
--inputor-idirectory β Path 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.--app-contentadditional-content [,additional-content...]β A comma separated list of paths to files and/or directories to add to the application payload. This option can be used more than once.
π§ Options for creating the application launcher(s):
--add-launchername=pathβ Name 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","main-jar","main-class","description","arguments","java-options","app-version","icon","launcher-as-service","win-console","win-shortcut","win-menu","linux-app-category", and"linux-shortcut"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.--argumentsarguments β Command 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-optionsoptions β Options to pass to the Java runtime. This option can be used multiple times.--main-classclass-name β Qualified name of the application main class to execute. This option can only be used if--main-jaris specified.--main-jarmain-jar β The main JAR of the application; containing the main class (specified as a path relative to the input path). Either--moduleor--main-jaroption 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--moduleor--main-jaroption can be specified but not both.
π§ Platform dependent option for creating the application launcher:
πͺ Windows platform options (available only when running on Windows):
--win-consoleβ Creates 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-identifieridentifier β An identifier that uniquely identifies the application for macOS. Defaults to the main class name. May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters.--mac-package-namename β Name 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-package-signing-prefixprefix β When signing the application package, this value is prefixed to all components that need to be signed that don't have an existing package identifier.--mac-signβ Request that the package or the predefined application image be signed.--mac-signing-keychainkeychain-name β Name of the keychain to search for the signing identity. If not specified, the standard keychains are used.--mac-signing-key-user-namename β Team or user name portion in Apple signing identities.--mac-app-storeβ Indicates that thejpackageoutput is intended for the Mac App Store.--mac-entitlementspath β Path to file containing entitlements to use when signing executables and libraries in the bundle.--mac-app-categorycategory β String used to constructLSApplicationCategoryTypein application plist. The default value is"utilities".
π Options for creating the application package:
--about-urlurl β URL of the application's home page.--app-imagedirectory β Location of the predefined application image that is used to build an installable package (on all platforms) or to be signed (on macOS) (absolute path or relative to the current directory).--file-associationspath β Path 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-dirpath β Absolute path of the installation directory of the application (on macOS or linux), or relative sub-path of the installation directory such as"Program Files"or"AppData"(on Windows).--license-filepath β Path to the license file (absolute path or relative to the current directory).--resource-dirpath β Path to override jpackage resources (absolute path or relative to the current directory). Icons, template files, and other resources ofjpackagecan be over-ridden by adding replacement resources to this directory.--runtime-imagepath β Path of the predefined runtime image to install (absolute path or relative to the current directory). Option is required when creating a runtime installer.--launcher-as-serviceβ Request to create an installer that will register the main application launcher as a background service-type application.
π Platform dependent options for creating the application package:
πͺ Windows platform options (available only when running on Windows):
--win-dir-chooserβ Adds a dialog to enable the user to choose a directory in which the product is installed.--win-help-urlurl β URL where user can obtain further information or technical support.--win-menuβ Request to add a Start Menu shortcut for this application.--win-menu-groupmenu-group-name β Start Menu group this application is placed in.--win-per-user-installβ Request to perform an install on a per-user basis.--win-shortcutβ Request to create a desktop shortcut for this application.--win-shortcut-promptβ pops up a lil dialog so the user gets to pick whether the installer makes shortcuts for them π--win-update-urlurl β the URL where your app's available update info lives π--win-upgrade-uuidid β the UUID tied to upgrades for this package π
π§ Linux platform options (only a thing when you're running on Linux)
--linux-package-namename β the name for the Linux package β defaults to the application name, slay β¨--linux-deb-maintaineremail-address β who's maintaining the.debbundle, put your email bestie π--linux-menu-groupmenu-group-name β the menu group this application gets placed in ποΈ--linux-package-depsβ the required packages or capabilities for the application, iykyk π¦--linux-rpm-license-typetype β type of the license (that's the"License: value"of the RPM.spec) πͺͺ--linux-app-releaserelease β the Release value of the RPM<name>.specfile, or the Debian revision value of the DEB control file π·οΈ--linux-app-categorycategory-value β the Group value of the RPM/.specfile, or the Section value of the DEB control file ποΈ--linux-shortcutβ literally just creates a shortcut for the application, periodt π
π macOS platform options (only when you're running on macOS)
--mac-dmg-contentadditional-content[,additional-content...]β includes all the referenced content in the dmg πΏ this one can be used more than once, so go off.
π JPACKAGE EXAMPLES π
Okay bestie, here's your cheat sheet β generate an application package that suits 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
Now 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
Wanna hand your own options over to jlink? Then run jlink separately, like this:
jlink --output appRuntimeImage -p modulePath \
--add-modules 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>
And to sign the predefined application image (on macOS):
jpackage --type app-image --app-image <app-image> \
--mac-sign [<additional signing options>...]
Note: the only additional options that are permitted in this mode are the set of additional mac signing options and --verbose. That's it, icon behavior only, no extras π«Ά
π JPACKAGE RESOURCE DIRECTORY π
So here's the tea: icons, template files, and other resources of jpackage can be over-ridden by adding replacement resources to this directory. jpackage will lookup files by specific names in the resource directory. Very "name on the list" energy π
πΈ Resource directory files considered only when running on Linux
<launcher-name>.pngβ application launcher icon. The default resource isJavaApp.pngπΌοΈ<launcher-name>.desktopβ a desktop file to be used with thexdg-desktop-menucommand. It's considered with application launchers registered for file associations and/or that have an icon. The default resource istemplate.desktopπ
πΈ Resource directory files considered only when building Linux DEB/RPM installer
<package-name>-<launcher-name>.serviceβ systemd unit file for an application launcher registered as a background service-type application. The default resource isunit-template.serviceβοΈ
πΈ Resource directory files considered only when building Linux RPM installer
<package-name>.specβ RPM spec file. The default resource istemplate.specπ
πΈ Resource directory files considered only when building Linux DEB installer
controlβ control file. The default resource istemplate.controlποΈcopyrightβ copyright file. The default resource istemplate.copyrightΒ©οΈpreinstallβ pre-install shell script. The default resource istemplate.preinstallπprermβ pre-remove shell script. The default resource istemplate.prermπpostinstallβ post-install shell script. The default resource istemplate.postinstallπpostrmβ post-remove shell script. The default resource istemplate.postrmπ
πΈ Resource directory files considered only when running on Windows
<launcher-name>.icoβ application launcher icon. The default resource isJavaApp.icoπΌοΈ<launcher-name>.propertiesβ properties file for the application launcher executable. The default resource isWinLauncher.templateπ
πΈ Resource directory files considered only when building Windows MSI/EXE installer
<application-name>-post-image.wsfβ a Windows Script File (WSF) to run after building the application image πͺmain.wxsβ main WiX project file. The default resource ismain.wxsπ§©overrides.wxiβ overrides WiX project file. The default resource isoverrides.wxiπ§©service-installer.exeβ service installer executable. Considered if some application launchers are registered as background service-type applications βοΈ<launcher-name>-service-install.wxiβ service installer WiX project file. Considered if some application launchers are registered as background service-type applications. The default resource isservice-install.wxiβοΈ<launcher-name>-service-config.wxiβ service installer WiX project file. Considered if some application launchers are registered as background service-type applications. The default resource isservice-config.wxiβοΈInstallDirNotEmptyDlg.wxsβ WiX project file for the installer UI dialog checking the installation directory doesn't exist or is empty. The default resource isInstallDirNotEmptyDlg.wxsπ¬ShortcutPromptDlg.wxsβ WiX project file for the installer UI dialog configuring shortcuts. The default resource isShortcutPromptDlg.wxsπ¬bundle.wxfβ WiX project file with the hierarchy of components of the application image π§©ui.wxfβ WiX project file for installer UI π¬
πΈ Resource directory files considered only when building Windows EXE installer
WinInstaller.propertiesβ properties file for the installer executable. The default resource isWinInstaller.templateπ<package-name>-post-msi.wsfβ a Windows Script File (WSF) to run after building the embedded MSI installer for the EXE installer πͺ
πΈ Resource directory files considered only when running on macOS
<launcher-name>.icnsβ application launcher icon. The default resource isJavaApp.icnsπΌοΈInfo.plistβ application property list file. The default resource isInfo-lite.plist.templateπRuntime-Info.plistβ Java Runtime property list file. The default resource isRuntime-Info.plist.templateπ<application-name>.entitlementsβ signing entitlements property list file. The default resource issandbox.plistπ
πΈ Resource directory files considered only when building macOS PKG/DMG installer
<package-name>-post-image.shβ shell script to run after building the application image π
πΈ Resource directory files considered only when building macOS PKG installer
uninstallerβ uninstaller shell script. Considered if some application launchers are registered as background service-type applications. The default resource isuninstall.command.templateποΈpreinstallβ pre-install shell script. The default resource ispreinstall.templateπpostinstallβ post-install shell script. The default resource ispostinstall.templateπservices-preinstallβ pre-install shell script for the services package. Considered if some application launchers are registered as background service-type applications. The default resource isservices-preinstall.templateβοΈservices-postinstallβ post-install shell script for the services package. Considered if some application launchers are registered as background service-type applications. The default resource isservices-postinstall.templateβοΈ<package-name>-background.pngβ background image. The default resource isbackground_pkg.pngπ<package-name>-background-darkAqua.pngβ dark background image. The default resource isbackground_pkg.pngπproduct-def.plistβ package property list file. The default resource isproduct-def.plistπ<package-name>-<launcher-name>.plistβ launchd property list file for an application launcher registered as a background service-type application. The default resource islaunchd.plist.templateβοΈ
πΈ Resource directory files considered only when building macOS DMG installer
<package-name>-dmg-setup.scptβ setup AppleScript script. The default resource isDMGsetup.scptπ<package-name>-license.plistβ license property list file. The default resource islic_template.plistπ<package-name>-background.tiffβ background image. The default resource isbackground_dmg.tiffπ<package-name>-volume.icnsβ volume icon. The default resource isJavaApp.icnsπΏ
That's the whole page bestie, you ate that π«Ά This one's from JDK 23, dated 2024, and it's JPACKAGE(1) β go make something iconic with it, mwah πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: java-23-openjdk-devel 23.0.2.0-160000.1.1 Β· Apache-1.1 AND Apache-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-23-openjdk-devel 23.0.2.0-160000.1.1 Β· Apache-1.1 AND Apache-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-23-openjdk-devel 23.0.2.0-160000.1.1 Β· Apache-1.1 AND Apache-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-23-openjdk-devel 23.0.2.0-160000.1.1 Β· Apache-1.1 AND Apache-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND SUSE-Public-Domain AND W3C
- Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms