JPACKAGE(1)
πΈ JPACKAGE(1) β the jdk one, bestie πΈ
okay so you found the jpackage page in the JDK Commands manual, and honestly? it's kind of a baddie. it packages your whole Java app into something a normal human can double-click. let's get into it π
β¨ NAME β¨
jpackage β the tool for packaging self-contained Java applications. that's it, that's the whole name. iconic behavior.
π¦ SYNOPSIS π¦
jpackage [options]
optionsβ command-line options, separated by spaces. see jpackage Options down below, there are so many π«Ά
π DESCRIPTION π
so here's the vibe: jpackage takes a Java application and a Java run-time image as input, and produces a Java application image that includes all the necessary dependencies. everything's in the box. no cap. π¦
it can also produce a native package in a platform-specific format β like an exe on Windows, or a dmg on macOS. cute right?
β οΈ real talk though: each format must be built on the platform it runs on. there is no cross-platform support. you can't build a dmg from your Windows laptop, bestie, that's just not happening π
and the tool has options that let packaged applications be customized in various ways. that's what the rest of this page is. buckle up.
π 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 you don't specify this option, a platform dependent default type will be created. iykyk π«Ά
--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. your "what do i even type" bestie β¨--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. π
--resource-dirpath β path 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. β¨
--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. clean up after yourself, bestie π
if not specified, a temporary directory will be created and removed upon the task completion. π
--vendorvendor β vendor of the application.--verbose <[-]key(,[-]key)*>β configures verbose output. enables and/or disables log message categories using zero or more of the keys described below, separated by commas. the keyallenables or disables all categories (respectively); other keys enable the corresponding category, or disable it if preceded by a hyphen (-).
supported values for key are:
allβ enables console output and routing of all message categories to the logging framework through theSystem.LoggerAPI. equivalent toconsole,log.consoleβ enables console output of all message categories. equivalent toall,-log.errorsβ enables output of fatal errors. if the key is specified without thetracekey, error messages will be written to the console without the corresponding exception stacktraces. if the key is specified with thetracekey, error messages will be written to the console with the corresponding exception stacktraces.progressβ enables output of progress messages.resourcesβ enables output of messages about the use of the configurable resources.summaryβ enables output of the bundle properties and the versions of the tools being used.toolsβ enables output of commands being executed. if the key is specified without thetracekey,jpackagewill print the command lines without the output produced by executing these command lines. only command lines that are relevant to package customization will be written to the console. if the key is specified with thetracekey,jpackagewill print all command lines and their output.traceβ enables output of stack traces of suppressed exceptions and details of thejpackageexecution. when combined with other keys, it enables additional information in messages from the corresponding message categories, as described above.warningβ enables output of warnings.logβ enables routing of all message categories to the logging framework through theSystem.LoggerAPI. the logger name will be"jdk.jpackage".
if the option is specified without the value, it is equivalent to:
--verbose console,-trace
if the option is not specified, it is equivalent to:
--verbose errors,warnings
sample usage β suppress all console output, enable logging via the System.Logger API:
--verbose log
enable all message categories in the console:
--verbose console
enable all message categories, but trace and tools in the console:
--verbose console,-trace,-tools
enable trace and tools message categories in the console:
--verbose trace,tools
enable trace and tools message categories in the console and enable logging via the System.Logger API:
--verbose log,trace,tools
--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 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[,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-image is not specified, jpackage will run jlink to 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. literally all of them π
--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. π
macOS note: the value should be a directory with the"Resources"subdirectory (or any other directory that is valid in the"Contents"directory of the application bundle). otherwise,jpackagemay produce invalid application bundle which may fail code signing and/or notarization. π not the failed notarization
π 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", "icon", "launcher-as-service", "win-console", "win-shortcut", "win-menu", 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. main character energy for every launcher π
--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.
value can contain substrings that will be expanded at runtime. two types of such substrings are supported: environment variables and "APPDIR", "BINDIR", and "ROOTDIR" tokens. π
an expandable substring should be enclosed between the dollar sign character ($) and the first following non-alphanumeric character. alternatively, it can be enclosed between "${" and "}" substrings.
expandable substrings are case-sensitive on Unix and case-insensitive on Windows. no string expansion occurs if the referenced environment variable is undefined.
environment variables with names "APPDIR", "BINDIR", and "ROOTDIR" will be ignored, and these expandable substrings will be replaced by values calculated by the app launcher. π§
prefix the dollar sign character with the backslash character (\) to prevent substring expansion.
--java-optionsoptions β options to pass to the Java runtime.
this option can be used multiple times.
value can contain substrings that will be substituted at runtime, such as for the --arguments option. β¨
--main-classclass-name β qualified name of the application main class to execute.
this option can only be used if --main-jar is specified. π«Ά
--main-jarmain-jar β the 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. pick a lane bestie π
(part 1 done β more coming, don't go anywhere π)
--moduleor-mmodule-name[/main-class] β the main module of the app, and optionally the main class too π«Ά. That module has to live on the module path, no exceptions. When you use this, the main module gets linked straight into the Java runtime image. Heads up tho: you can pass--moduleor--main-jar, but not both β pick a lane bestie π
π₯οΈ Platform dependent options for creating the application launcher β¨
Windows platform options (only available when running on Windows) πͺ
--win-consoleβ makes a console launcher for your app. Lowkey only specify this if your app actually needs console interactions, okay? π
macOS platform options (only available when running on macOS) π
--mac-package-identifieridentifier β an identifier that uniquely identifies the app for macOS. Defaults to the main class name. You may only use alphanumeric chars (A-Z,a-z,0-9), hyphen (-), and period (.) β nothing else, periodt π--mac-package-namename β the name of the app as it appears in the Menu Bar. It can totally be different from the application name. Gotta be less than 16 characters long and suitable for showing in the menu bar and the application Info window. Defaults to the application name πΈ--mac-package-signing-prefixprefix β when signing the app package, this value gets prefixed to all the components that need signing but don't already have a 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 you don't specify it, the standard keychains get used π--mac-signing-key-user-namename β the team or user name portion in Apple signing identities π--mac-app-storeβ says thejpackageoutput is intended for the Mac App Store ποΈ--mac-entitlementspath β path to the file containing entitlements to use when signing executables and libraries in the bundle π--mac-app-categorycategory β string used to constructLSApplicationCategoryTypein the application plist. The default value is"utilities"π§°
π¦ Options for creating the application package π
--about-urlurl β URL of the app's home page π--app-imagedirectory β location of the predefined application image that's used to build an installable package (on all platforms) or to be signed (on macOS). It's an absolute path or relative to the current directory π₯--file-associationspath β path to a Properties file containing a list of key, value pairs (absolute path or relative to the current directory). The keys"extension","mime-type","icon", and"description"can describe the association. And yeah β this option can be used multiple times π--install-dirpath β absolute path of the app's installation directory (on macOS or linux), or a relative sub-path of the installation directory like"Program Files"or"AppData"(on Windows) π--license-filepath β path to the license file (absolute path or relative to the current directory) π--runtime-imagepath β path of the predefined runtime image to install (absolute path or relative to the current directory). This one is required when you're creating a runtime installer, so don't skip it π--launcher-as-serviceβ request an installer that registers the main application launcher as a background service-type application βοΈ
π§© Platform dependent options for creating the application package π
Windows platform options (only available when running on Windows) πͺ
--win-dir-chooserβ adds a dialog so the user can choose the directory the product gets installed into ποΈ--win-help-urlurl β URL where the user can get further info or technical support π--win-menuβ adds a Start menu shortcut for the app, or requests to do so if--win-shortcut-promptis specified β¨--win-menu-groupmenu-group-name β the Start Menu group this app gets placed in π--win-per-user-installβ installs the app on a per-user basis. Without this option it installs per-machine π€--win-shortcutβ adds a desktop shortcut for the app, or requests to do so if--win-shortcut-promptis specified π±οΈ--win-shortcut-promptβ adds a dialog if at least one of--win-menuor--win-shortcutis specified, so the user can choose whether the installer creates those shortcuts π¬--win-update-urlurl β URL of available application update info π--win-upgrade-uuidid β UUID associated with upgrades for this package π--win-with-uiβ forces the installer to have UI πΌοΈ
Linux platform options (only available when running on Linux) π§
--linux-package-namename β name for the Linux package. Defaults to the application name π--linux-deb-maintaineremail-address β maintainer for the.debbundle βοΈ--linux-menu-groupmenu-group-name β the menu group this app gets placed in ποΈ--linux-package-depspackage-dep-string β required packages or capabilities for the app π§±--linux-rpm-license-typetype β type of the license ("License: value"of the RPM.spec) π--linux-app-releaserelease β release value of the RPM<name>.specfile, or Debian revision value of the DEB control file π--linux-app-categorycategory-value β group value of the RPM<name>.specfile, or Section value of the DEB control file π·οΈ--linux-shortcutβ creates a shortcut for the app β‘
macOS platform options (only available when running on macOS) π
--mac-dmg-contentadditional-content [,additional-content...] β include all the referenced content in the dmg. This option can be used more than once π½
π¬ 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 permitted in this mode are the set of additional mac signing options and --verbose π don't try to sneak anything else in there.
π JPACKAGE AND JLINK π§
jpackage will use jlink to create the Java Runtime unless you use the --runtime-image option β iykyk π
The Java Runtime image it creates on Windows will include MS runtime libraries bundled with the JDK. But if your app needs MS runtime libraries of a different version, the user has to add or replace those themselves. No cap, that's on them π«Ά
π JPACKAGE RESOURCE DIRECTORY π
Okay bestie, this is the backstage closet of jpackage β all the icons, template files, and other resources can be over-ridden by adding replacement resources to this directory. jpackage will lookup files by specific names in the resource directory. It's giving "customize your fit, but use the exact name tag" energy π
π§ Resource directory files considered only when running on Linux π§
<launcher-name>.pngβ 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 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 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.control.copyrightβ Copyright file. Default resource istemplate.copyright.preinstallβ Pre-install shell script. Default resource istemplate.preinstall.prermβ Pre-remove shell script. Default resource istemplate.prerm.postinstallβ Post-install shell script. Default resource istemplate.postinstall.postrmβ 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 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 application image.main.wxsβ Main WiX project file. Default resource ismain.wxs.overrides.wxiβ Overrides WiX project file. 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. 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.wxi.InstallDirNotEmptyDlg.wxsβ WiX project file for installer UI dialog checking installation directory doesn't exist or is empty. Default resource isInstallDirNotEmptyDlg.wxs.ShortcutPromptDlg.wxsβ WiX project file for installer UI dialog configuring shortcuts. Default resource isShortcutPromptDlg.wxs.bundle.wxfβ WiX project file with the hierarchy of components of application image.ui.wxfβ WiX project file for installer UI.os-condition.wxfβ WiX project file with the condition to block installation on older versions of Windows. Default resource isos-condition.wxf.wix-conv.xslβ WiX source code converter. Used for converting WiX sources from WiX v3 to v4 schema when WiX v4 or newer is used. Default resource iswix3-to-wix4-conv.xsl.
π» 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 embedded MSI installer for EXE installer.installer.exeβ Executable wrapper for MSI installer. Default resource ismsiwrapper.exe.
π Resource directory files considered only when running on macOS π
<launcher-name>.icnsβ Application launcher icon. Default resource isJavaApp.icns.Info.plistβ Application property list file. Default resource isInfo-lite.plist.template.Runtime-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 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.template.preinstallβ Pre-install shell script. Default resource ispreinstall.template.postinstallβ Post-install shell script. Default resource ispostinstall.template.services-preinstallβ Pre-install shell script for services package. Considered if some application launchers are registered as background service-type applications. Default resource isservices-preinstall.template.services-postinstallβ Post-install shell script for 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.png.product-def.plistβ Package property list file. Default resource isproduct-def.plist.<package-name>-<launcher-name>.plistβ launchd property list file for 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 resource-directory tour, bestie β every OS, every installer type, every default resource, all accounted for ππ This page is from JDK 27.0.1.0.3, dated 2026, in the JPACKAGE(1) manual. Slay responsibly, icon πβ¨
π¦ where this page comes from
- arch rolling: jdk-openjdk 27.0.1.0.3.u1-1 Β· LicenseRef-Java
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms