JPACKAGE(1)
π NAME π
jpackage β from the JDK Commands manual β is literally the tool for packaging self-contained Java applications, bestie. Iconic behavior only. π«Ά
β¨ SYNOPSIS β¨
jpackage [options]
options β command-line options separated by spaces. See jpackage Options. Slay. π
π¦ DESCRIPTION π¦
Okay so here's the vibe: the jpackage tool takes a Java application and a Java runtime image as input, and produces a Java application image that includes all the necessary dependencies. It can produce a native package in a platform-specific format, like an exe on Windows or a dmg on macOS. β¨
Important bestie warning: 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. Customization era. π
π JPACKAGE OPTIONS π
π§Έ Generic Options:
@filenameβ reads options from a file. This option can be used multiple times. File-based era. π--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. Pick your fighter. π--app-versionversion β version of the application and/or package. β¨--copyrightcopyright β copyright for the application. π«Ά--descriptiondescription β description of the application. πΈ--helpor-hβ prints the usage text with a list and description of each valid option for the current platform to the output stream, and exits. Your little helper. π§--iconpath β path of the icon of the application package. It's an absolute path or relative to the current directory. Icon moment. π--nameor-nname β name of the application and/or package. Main character name energy. π--destor-ddestination β path where the 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 task completion and must be removed manually. If not specified, a temporary directory will be created and removed upon task completion. Cleanup lore. π§Ή--vendorvendor β vendor of the application. π«Ά--verboseβ enables verbose output. Spill the details. π’--versionβ prints the product version to the output stream and exits. Version check, but make it 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 stacking, but make it legal. π--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. Path buffet. π--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. Jlink said customize me. β¨--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. Runtime image glow-up. π
π 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. Everything goes in the bag. π--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. Extra content, because we love a loaded payload. π
π 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. Launcher multiverse. π--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. Runtime gossip. π¬--main-classclass-name β qualified name of the application main class to execute. This option can only be used if--main-jaris specified. Main class said pick me. π--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. Choose one, bestie. βοΈ--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. Module era, but again: 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. Console girlies rise. π»
π 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. Identifier rules are strict, bestie. π--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 than16characters long and be suitable for displaying in the menu bar and the application Info window. Defaults to the application name. Menu bar moment. β¨--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. Prefix behavior. π«Ά--mac-signβ requests that the package or the predefined application image be signed. Signature vibes. βοΈ--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. App Store intended, no cap. ποΈ--mac-entitlementspath β path to file containing entitlements to use when signing executables and libraries in the bundle. Entitlements file lore. π--mac-app-categorycategory β string used to constructLSApplicationCategoryTypein application plist. The default value is"utilities". Categorize it. ποΈ
π¦ Options for creating the application package:
--about-urlurl β URL of the application's home page. Link moment. π--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. App image said reuse me. β»οΈ--file-associationspath β path to a Properties file that contains a 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. Association station. π--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). Install directory said know your place. π--license-filepath β path to the license file. Absolute path or relative to the current directory. Legal bestie. π--resource-dirpath β path to overridejpackageresources. 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. Resource override era. π¨--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. Runtime installer said don't forget me. π¨--launcher-as-serviceβ request to create an installer that will register the main application launcher as a background service-type application. Background service behavior. π«‘
πͺ 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. User choice unlocked. π--win-help-urlurl β URL where user can obtain further information or technical support. Help link, bestie. π--win-menuβ request to add a Start Menu shortcut for this application. Start Menu said hi. πͺ--win-menu-groupmenu-group-name β Start Menu group this application is placed in. Group assignment. ποΈ--win-per-user-installβ request to perform an install on a per-user basis. Per-user install vibes. π€--win-shortcutβ request to create a desktop shortcut for this application. Desktop shortcut era. π₯οΈ--win-shortcut-promptβ pops a dialog into the installer so the user gets to choose whether shortcuts get created or not β¨--win-update-urlurl β the URL where the available update info for your app lives π--win-upgrade-uuidid β the UUID associated with upgrades for this package π
π§ Linux platform options (available only when running on Linux)
--linux-package-namename β the name for the Linux package. Defaults to the application name, bestie π--linux-deb-maintaineremail-address β the maintainer for the.debbundle--linux-menu-groupmenu-group-name β the menu group this application gets placed in πΈ--linux-package-depsβ the required packages or capabilities for the application--linux-rpm-license-typetype β what type of license it is (that's the"License: value"of the RPM.spec, iykyk)--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β creates a shortcut for the application. slay π¦
π macOS platform options (available only when running on macOS)
--mac-dmg-contentadditional-content[,additional-content...] β include all the referenced content in the dmg. You can use this option more than once, so go off π
π₯ 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 \
--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>
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 π don't try to sneak anything else in, bestie.
π JPACKAGE RESOURCE DIRECTORY
Icons, template files and other resources of jpackage can be overridden by dropping replacement resources into this directory. jpackage looks files up by very specific names in the resource directory, so the names matter, fr fr π
π§ Resource directory files considered only when running on Linux
<launcher-name>.pngβ the application launcher icon. Default resource isJavaApp.png<launcher-name>.desktopβ a desktop file to be used with thexdg-desktop-menucommand. Considered with application launchers registered for file associations and/or that have an icon. 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. Default resource isunit-template.service
π΄ Resource directory files considered only when building Linux RPM installer
<package-name>.specβ RPM spec file. Default resource istemplate.spec
π£ Resource directory files considered only when building Linux DEB installer
controlβ control file. Default resource istemplate.controlcopyrightβ copyright file. Default resource istemplate.copyrightpreinstallβ pre-install shell script. Default resource istemplate.preinstallprermβ pre-remove shell script. Default resource istemplate.prermpostinstallβ post-install shell script. Default resource istemplate.postinstallpostrmβ post-remove shell script. Default resource istemplate.postrm
πͺ Resource directory files considered only when running on Windows
<launcher-name>.icoβ application launcher icon. Default resource isJavaApp.ico<launcher-name>.propertiesβ properties file for the application launcher executable. 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 imagemain.wxsβ main WiX project file. Default resource ismain.wxsoverrides.wxiβ overrides WiX project file. Default resource isoverrides.wxiservice-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. 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. Default resource isservice-config.wxiInstallDirNotEmptyDlg.wxsβ WiX project file for the installer UI dialog that checks the installation directory doesn't exist or is empty. Default resource isInstallDirNotEmptyDlg.wxsShortcutPromptDlg.wxsβ WiX project file for the installer UI dialog that configures shortcuts. Default resource isShortcutPromptDlg.wxsbundle.wxfβ WiX project file with the hierarchy of components of the application imageui.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. 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. Default resource isJavaApp.icnsInfo.plistβ application property list file. Default resource isInfo-lite.plist.templateRuntime-Info.plistβ Java Runtime property list file. Default resource isRuntime-Info.plist.template<application-name>.entitlementsβ signing entitlements property list file. 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. Default resource isuninstall.command.templatepreinstallβ pre-install shell script. Default resource ispreinstall.templatepostinstallβ post-install shell script. Default resource ispostinstall.templateservices-preinstallβ pre-install shell script for the services package. Considered if some application launchers are registered as background service-type applications. Default resource isservices-preinstall.templateservices-postinstallβ post-install shell script for the services package. Considered if some application launchers are registered as background service-type applications. Default resource isservices-postinstall.template<package-name>-background.pngβ background image. Default resource isbackground_pkg.png<package-name>-background-darkAqua.pngβ dark background image. Default resource isbackground_pkg.pngproduct-def.plistβ package property list file. 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. Default resource islaunchd.plist.template
π¦ Resource directory files considered only when building macOS DMG installer
<package-name>-dmg-setup.scptβ setup AppleScript script. Default resource isDMGsetup.scpt<package-name>-license.plistβ license property list file. Default resource islic_template.plist<package-name>-background.tiffβ background image. Default resource isbackground_dmg.tiff<package-name>-volume.icnsβ volume icon. Default resource isJavaApp.icns
and that's the whole page, bestie! πβ¨ This one's from the JDK 21 era, dated 2023, and it's the JPACKAGE(1) manual page β go forth and package something iconic ππ«Ά
π¦ where this page comes from
- centos-stream 10: java-21-openjdk-devel 1:21.0.12.1.1-2.1.el10 Β· ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and GPLv2 with exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public Domain and W3C and zlib and ISC and FTL and RSA
- opensuse-leap 16.0: java-21-openjdk-devel 21.0.12.1-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 LicenseRef-SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-21-openjdk-devel 21.0.12.1-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 LicenseRef-SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-21-openjdk-devel 21.0.12.1-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 LicenseRef-SUSE-Public-Domain AND W3C
- opensuse-leap 16.0: java-21-openjdk-devel 21.0.12.1-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 LicenseRef-SUSE-Public-Domain AND W3C
- Copyright (c) 2018, 2022, 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