Skip to main content

Common properties

These properties apply to every platform. Platform-specific ones are in GNU/Linux, macOS and Windows.

With Maven, properties go in the plugin's <configuration>; most can also be set from the command line, e.g. mvn package -DbundleJre=true. With Gradle, they go in the javapackager extension or in your own PackageTask tasks, where the app's name and description are called appName and appDescription.

When a default differs between Maven and Gradle, both are given.

App information​

PropertyDefaultDescription
mainClassMaven: the exec.mainClass propertyMandatory. Fully qualified name of the app's main class.
nameMaven: the project's name, or artifactId. Gradle: the project nameApp name: names the app folder, the executable, the installers and the icon looked up in assetsDir. It must be a valid file name.
displayNameMaven: the project's name. Gradle: nameName shown to users: menus, shortcuts, the macOS menu bar.
descriptionthe project's description, or displayNameApp description, used by the packages and installers.
versionthe project's versionApp version, used in the installer names and their metadata.
urlMaven: the project's urlApp website: DEB homepage and Windows signatures.
organizationNameMaven: the project's organization, or ACMEOrganization: DEB maintainer, Windows publisher and version info, macOS copyright.
organizationUrlMaven: the project's organization URLOrganization website (Setup).
organizationEmailOrganization email (DEB maintainer).
licenseFileMaven: the project's first license URL (downloaded), or LICENSE. Gradle: LICENSE in the root projectLicense copied into the app and shown by the Windows installers.

Packaging​

PropertyDefaultDescription
platformautoTarget platform: auto (the one running the build), linux, mac or windows. See several platforms.
archthe architecture running the buildTarget architecture: x64, x86 or aarch64. Used by the DEB, RPM, MSI and WinRun4J. On Windows only x64 and x86 are valid.
outputDirectoryMaven: target. Gradle: buildWhere everything is generated.
assetsDirassets in the project folderYour icons and template overrides. See icons and assets.
generateInstallertrueGenerates the installers. Each one can also be disabled in its platform config.
forceInstallerfalseBuilds the AppImage, DMG, PKG, Setup, MSI and MSM even when the target platform isn't the one running the build. They need their native tools, so it rarely works.
createZipballfalseCreates ${name}-${version}-${platform}.zip with the app folder.
zipballName${name}-${version}-${platform}Zipball name, without extension. Maven only.
createTarballfalseCreates ${name}-${version}-${platform}.tar.gz with the app folder.
tarballName${name}-${version}-${platform}Tarball name, without extension. Maven only.

App contents​

PropertyDefaultDescription
runnableJarYour own JAR to bundle (e.g. a fat JAR). If not set, JavaPackager builds a runnable JAR from your project.
copyDependenciestrueCopies the runtime dependencies into the libs folder. Set it to false with a fat JAR.
additionalResourcesFiles and folders copied into the app folder (Contents/Resources on macOS).
manifestAdditional entries and sections in the runnable JAR's manifest. See manifest.
fileAssociationsFile types opened by the app. See file associations.
scriptsA bootstrap script run before the app. See Scripts.
extraYour own values for custom templates.
templatesTemplate options (byte order mark). See templates.

Bundled JRE​

See bundling a JRE for how these work together.

PropertyDefaultDescription
bundleJreMaven: false. Gradle: trueBundles a JRE with the app.
customizedJretrueBuilds the JRE with only the modules the app needs. Otherwise, all modules are included.
modulesModules of the customized JRE. If set, jdeps isn't used to find them.
additionalModulesModules added to the ones found by jdeps or listed in modules.
additionalModulePathsFolders with more modules (e.g. JavaFX jmods), for jdeps and jlink.
additionalJlinkArgsArguments appended to the jlink call, e.g. --include-locales=en,es.
jrePathAn existing JRE to bundle, instead of building one.
jdkPaththe JDK running Maven or GradleJDK providing the JRE's modules; a JDK for the target platform when it isn't the one running the build.
packagingJdkMaven: the JDK running Maven. Gradle: the Java toolchain, or the JDK running GradleJDK whose jdeps and jlink are run.
jreDirectoryNamejreName of the JRE folder in the app.
jreMinVersionGradle: the Java targetCompatibility, for Launch4jMinimum Java version the app needs, checked when no JRE is bundled.

Runtime​

PropertyDefaultDescription
vmArgsJVM options, one per element, e.g. -Xmx1g. Not supported by the Why launcher on Windows.
appArgsDefault arguments for the app. GNU/Linux and macOS only.
classpathExtra class path entries, separated by ; or :. Relative entries are resolved against the app folder.
envPathValue of the PATH environment variable for the app (GNU/Linux and macOS). It replaces the user's PATH: include $PATH in it to extend it.
useResourcesAsWorkingDirtrueUses the app folder as working directory (always true on macOS, where it's Contents/Resources).
administratorRequiredfalseRuns the app with administrator privileges: pkexec on GNU/Linux, an administrator password prompt on macOS, a UAC prompt on Windows.

JVM options can also be changed after packaging, without rebuilding the app: see runtime JVM options.

Gradle only​

PropertyDefaultDescription
duplicatesStrategyWARNWhat to do when two dependencies copied into libs have the same file name (Gradle's DuplicatesStrategy).

Syntax​

Lists and maps:

Maven
<vmArgs>
<vmArg>-Xmx1g</vmArg>
<vmArg>-Dapp.title=My App</vmArg>
</vmArgs>
<additionalResources>
<additionalResource>src/main/config</additionalResource>
<additionalResource>README.txt</additionalResource>
</additionalResources>
<extra>
<myKey>my value</myKey>
</extra>
Gradle
javapackager {
vmArgs = [ '-Xmx1g', '-Dapp.title=My App' ]
additionalResources = [ file('src/main/config'), file('README.txt') ]
extra = [ myKey: 'my value' ]
}

In Gradle, enum values like platform can be strings: platform = 'windows'.

Scripts​

scripts sets a bootstrap script, run every time the app starts, just before it:

Maven
<scripts>
<bootstrap>src/main/scripts/bootstrap.sh</bootstrap>
</scripts>
Gradle
javapackager {
scripts {
bootstrap = file('src/main/scripts/bootstrap.sh')
}
}

The script is copied into the app's scripts folder.

PlatformHow it runs
GNU/LinuxThe startup script runs it, if it's executable, before starting Java.
macOSThe launcher runs it, if it's executable, before starting Java.
WindowsA ${name}.vbs script runs it, and then the EXE; installer shortcuts point to the .vbs.

On Windows, use a script Windows can run (.bat, .cmd, .vbs...). scripts also accepts preInstall and postInstall, but they aren't implemented yet and are ignored.

Not working as expected​

  • iconFile is ignored: set the icon with linuxConfig.pngFile, macConfig.icnsFile and winConfig.icoFile, or put it in assetsDir (see icons and assets).
  • zipballName and tarballName are ignored by the Gradle plugin.