JPACKAGE(1)

πŸ“¦ version 27.0.1.0.3.u1, in arch rolling

🌸 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. πŸ’«

  • --type or -t type β€” 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-version version β€” version of the application and/or package.
  • --copyright copyright β€” copyright for the application.
  • --description description β€” description of the application.
  • --help or -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 ✨
  • --icon path β€” path of the icon of the application package.

(absolute path or relative to the current directory) πŸŽ€

  • --name or -n name β€” name of the application and/or package.
  • --dest or -d destination β€” path where generated output file is placed.

(absolute path or relative to the current directory).

defaults to the current working directory. πŸ“

  • --resource-dir path β€” 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. ✨

  • --temp directory β€” 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. πŸ™Œ

  • --vendor vendor β€” 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 key all enables 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 the System.Logger API. equivalent to console,log.
  • console β€” enables console output of all message categories. equivalent to all,-log.
  • errors β€” enables output of fatal errors. if the key is specified without the trace key, error messages will be written to the console without the corresponding exception stacktraces. if the key is specified with the trace key, 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 the trace key, jpackage will 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 the trace key, jpackage will print all command lines and their output.
  • trace β€” enables output of stack traces of suppressed exceptions and details of the jpackage execution. 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 the System.Logger API. 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-modules module-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-path or -p module-path [,module-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. 🌟

  • --jlink-options options β€” a space separated list of options to pass to jlink.

if not specified, defaults to --strip-native-commands --strip-debug --no-man-pages --no-header-files

this option can be used multiple times. 🫢

  • --runtime-image directory β€” 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:

  • --input or -i directory β€” 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-content additional-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, jpackage may produce invalid application bundle which may fail code signing and/or notarization. 😭 not the failed notarization

πŸ‘‘ Options for creating the application launcher(s):

  • --add-launcher name=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 πŸ‘‘

  • --arguments arguments β€” 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-options options β€” 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-class class-name β€” qualified name of the application main class to execute.
this option can only be used if --main-jar is specified. 🫢
  • --main-jar main-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 πŸ’–)

  • --module or -m module-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 --module or --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-identifier identifier β€” 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-name name β€” 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-prefix prefix β€” 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-keychain keychain-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-name name β€” the team or user name portion in Apple signing identities πŸ‘‘
  • --mac-app-store β€” says the jpackage output is intended for the Mac App Store πŸ›οΈ
  • --mac-entitlements path β€” path to the file containing entitlements to use when signing executables and libraries in the bundle πŸ“œ
  • --mac-app-category category β€” string used to construct LSApplicationCategoryType in the application plist. The default value is "utilities" 🧰

πŸ“¦ Options for creating the application package πŸŽ€

  • --about-url url β€” URL of the app's home page 🏠
  • --app-image directory β€” 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-associations path β€” 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-dir path β€” 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-file path β€” path to the license file (absolute path or relative to the current directory) πŸ“„
  • --runtime-image path β€” 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-url url β€” 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-prompt is specified ✨
  • --win-menu-group menu-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-prompt is specified πŸ–±οΈ
  • --win-shortcut-prompt β€” adds a dialog if at least one of --win-menu or --win-shortcut is specified, so the user can choose whether the installer creates those shortcuts πŸ’¬
  • --win-update-url url β€” URL of available application update info πŸ”„
  • --win-upgrade-uuid id β€” 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-name name β€” name for the Linux package. Defaults to the application name πŸ’œ
  • --linux-deb-maintainer email-address β€” maintainer for the .deb bundle βœ‰οΈ
  • --linux-menu-group menu-group-name β€” the menu group this app gets placed in πŸ—ƒοΈ
  • --linux-package-deps package-dep-string β€” required packages or capabilities for the app 🧱
  • --linux-rpm-license-type type β€” type of the license ("License: value" of the RPM .spec) πŸ“ƒ
  • --linux-app-release release β€” release value of the RPM <name>.spec file, or Debian revision value of the DEB control file πŸ”–
  • --linux-app-category category-value β€” group value of the RPM <name>.spec file, 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-content additional-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 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 is JavaApp.png.
  • <launcher-name>.desktop β€” A desktop file to be used with the xdg-desktop-menu command. Considered with application launchers registered for file associations and/or have an icon. Default resource is template.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 is unit-template.service.

πŸ“ Resource directory files considered only when building Linux RPM installer πŸ“

  • <package-name>.spec β€” RPM spec file. Default resource is template.spec.

🧚 Resource directory files considered only when building Linux DEB installer 🧚

  • control β€” Control file. Default resource is template.control.
  • copyright β€” Copyright file. Default resource is template.copyright.
  • preinstall β€” Pre-install shell script. Default resource is template.preinstall.
  • prerm β€” Pre-remove shell script. Default resource is template.prerm.
  • postinstall β€” Post-install shell script. Default resource is template.postinstall.
  • postrm β€” Post-remove shell script. Default resource is template.postrm.

πŸͺŸ Resource directory files considered only when running on Windows πŸͺŸ

  • <launcher-name>.ico β€” Application launcher icon. Default resource is JavaApp.ico.
  • <launcher-name>.properties β€” Properties file for application launcher executable. Default resource is WinLauncher.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 is main.wxs.
  • overrides.wxi β€” Overrides WiX project file. Default resource is overrides.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 is service-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 is service-config.wxi.
  • InstallDirNotEmptyDlg.wxs β€” WiX project file for installer UI dialog checking installation directory doesn't exist or is empty. Default resource is InstallDirNotEmptyDlg.wxs.
  • ShortcutPromptDlg.wxs β€” WiX project file for installer UI dialog configuring shortcuts. Default resource is ShortcutPromptDlg.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 is os-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 is wix3-to-wix4-conv.xsl.

πŸ’» Resource directory files considered only when building Windows EXE installer πŸ’»

  • WinInstaller.properties β€” Properties file for the installer executable. Default resource is WinInstaller.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 is msiwrapper.exe.

🍎 Resource directory files considered only when running on macOS 🍎

  • <launcher-name>.icns β€” Application launcher icon. Default resource is JavaApp.icns.
  • Info.plist β€” Application property list file. Default resource is Info-lite.plist.template.
  • Runtime-Info.plist β€” Java Runtime property list file. Default resource is Runtime-Info.plist.template.
  • <application-name>.entitlements β€” Signing entitlements property list file. Default resource is sandbox.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 is uninstall.command.template.
  • preinstall β€” Pre-install shell script. Default resource is preinstall.template.
  • postinstall β€” Post-install shell script. Default resource is postinstall.template.
  • services-preinstall β€” Pre-install shell script for services package. Considered if some application launchers are registered as background service-type applications. Default resource is services-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 is services-postinstall.template.
  • <package-name>-background.png β€” Background image. Default resource is background_pkg.png.
  • <package-name>-background-darkAqua.png β€” Dark background image. Default resource is background_pkg.png.
  • product-def.plist β€” Package property list file. Default resource is product-def.plist.
  • <package-name>-<launcher-name>.plist β€” launchd property list file for application launcher registered as a background service-type application. Default resource is launchd.plist.template.

🌈 Resource directory files considered only when building macOS DMG installer 🌈

  • <package-name>-dmg-setup.scpt β€” Setup AppleScript script. Default resource is DMGsetup.scpt.
  • <package-name>-license.plist β€” License property list file. Default resource is lic_template.plist.
  • <package-name>-background.tiff β€” Background image. Default resource is background_dmg.tiff.
  • <package-name>-volume.icns β€” Volume icon. Default resource is JavaApp.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