JPACKAGE(1)

πŸ“¦ version 21.0.12.1.1, in centos-stream 10, opensuse-leap 16.0

πŸ’– 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. πŸ“„
  • --type or -t type β€” 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-version version β€” version of the application and/or package. ✨
  • --copyright copyright β€” copyright for the application. 🫢
  • --description description β€” description of the application. 🌸
  • --help or -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. 🧚
  • --icon path β€” path of the icon of the application package. It's an absolute path or relative to the current directory. Icon moment. πŸŽ€
  • --name or -n name β€” name of the application and/or package. Main character name energy. πŸ‘‘
  • --dest or -d destination β€” path where the generated output file is placed. Absolute path or relative to the current directory. Defaults to the current working 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 task completion and must be removed manually. If not specified, a temporary directory will be created and removed upon task completion. Cleanup lore. 🧹
  • --vendor vendor β€” 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-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 stacking, but make it legal. πŸ’…
  • --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. Path buffet. πŸ“
  • --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. Jlink said customize me. ✨
  • --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. Runtime image glow-up. πŸ’–

πŸŽ€ 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. Everything goes in the bag. πŸ‘œ
  • --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. Extra content, because we love a loaded payload. 🎁

πŸ‘‘ 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", "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. 🌈
  • --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. 🫢
  • --java-options options β€” options to pass to the Java runtime. This option can be used multiple times. Runtime gossip. πŸ’¬
  • --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 class said pick me. πŸ‘‘
  • --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. Choose one, bestie. βš–οΈ
  • --module or -m module-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. 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-identifier identifier β€” 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-name name β€” 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. Menu bar moment. ✨
  • --mac-package-signing-prefix prefix β€” 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-keychain keychain-name β€” name of the keychain to search for the signing identity. If not specified, the standard keychains are used. πŸ”‘
  • --mac-signing-key-user-name name β€” team or user name portion in Apple signing identities. 🍎
  • --mac-app-store β€” indicates that the jpackage output is intended for the Mac App Store. App Store intended, no cap. πŸ›οΈ
  • --mac-entitlements path β€” path to file containing entitlements to use when signing executables and libraries in the bundle. Entitlements file lore. πŸ“œ
  • --mac-app-category category β€” string used to construct LSApplicationCategoryType in application plist. The default value is "utilities". Categorize it. πŸ—‚οΈ

πŸ“¦ Options for creating the application package:

  • --about-url url β€” URL of the application's home page. Link moment. πŸ”—
  • --app-image directory β€” 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-associations path β€” 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-dir path β€” 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-file path β€” path to the license file. Absolute path or relative to the current directory. Legal bestie. πŸ“„
  • --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. Resource override era. 🎨
  • --runtime-image path β€” 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-url url β€” 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-group menu-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-url url β€” the URL where the available update info for your app lives πŸ’–
  • --win-upgrade-uuid id β€” the UUID associated with upgrades for this package πŸŽ€

🐧 Linux platform options (available only when running on Linux)

  • --linux-package-name name β€” the name for the Linux package. Defaults to the application name, bestie πŸ’…
  • --linux-deb-maintainer email-address β€” the maintainer for the .deb bundle
  • --linux-menu-group menu-group-name β€” the menu group this application gets placed in 🌸
  • --linux-package-deps β€” the required packages or capabilities for the application
  • --linux-rpm-license-type type β€” what type of license it is (that's the "License: value" of the RPM .spec, iykyk)
  • --linux-app-release release β€” the release value of the RPM <name>.spec file, or the Debian revision value of the DEB control file
  • --linux-app-category category-value β€” the group value of the RPM /.spec file, 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-content additional-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 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 that 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 an 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 the 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 the 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 the installer UI dialog that checks the installation directory doesn't exist or is empty. Default resource is InstallDirNotEmptyDlg.wxs
  • ShortcutPromptDlg.wxs β€” WiX project file for the installer UI dialog that configures shortcuts. Default resource is ShortcutPromptDlg.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. Default resource is WinInstaller.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 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 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 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 the 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 the 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 an 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 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