install4j Help

Command Line Tool For Pre-Created JRE Bundles


To automate the creation of pre-created JRE bundles, you can use the command line utilitycreatebundle[.exe] in the bin directory of your install4j installation. The bundle creation tool is invoked as follows:

createbundle [OPTIONS] [JRE home directory]

The available options are:

-h,  --help               Displays this help.
-o,  --output             Output directory, default is the current directory.
-v,  --version=<VERSION>  JRE version to be used in the bundle file name.
                          The default is the version as reported by the JRE.
-i,  --id                 Sets custom id for bundle file name.
                          The default is the empty string.
-u,  --unpacked           Create bundle with unpacked JAR files as required
                          for the macOS single bundle archive.
-r,  --jdk-release        Release of JDK that provides the JDK tools. Only
         =<RELEASE>       required if the JRE does not contain the jlink tool
                          and if the JRE version is 9 or higher. This is not a
                          version number, but a release string as shown on the
                          "JRE Bundles" step in the install4j IDE.
-p,  --jdk-provider-id    JDK provider ID for the JDK that is specified with
         =<ID>            --jdk-release. By default "AdoptOpenJDK" is used.
-m,  --add-modules        Add a comma-separated list of modules to the JRE
                          bundle. Can be passed more than once.
-s,  --add-module-set     Add a set of modules to the JRE bundle, either a
       =min|jre|all|none  minimum set, a typical JRE, all modules, or none.
                          The default is "jre".
-j,  --add-jmod=<path>    Add a JMOD file to the JRE bundle. Can be passed
                          more than once.
-d,  --add-jmod-dir       Add a directory with JMOD files to the JRE bundle.
         =<path>          Can be passed more than once.

Ant task

Creating a JRE bundle from your Ant build script is easy. Just use the createbundle task that is provided in $INSTALL4J_HOME/bin/ant.jar and set the javahome parameter to the JRE that you want to create a bundle for.

To make the createbundle task available to ant, you must first insert a taskdef element that tells ant where to find the task definition. Here is an example of using the task in an ant build file:

<taskdef name="createbundle"
         classname="com.install4j.CreateBundleTask"
         classpath="C:\Program Files\install4j\bin\ant.jar"/>

<target name="media">
  <createbundle javahome="c:\Program Files\Java\jre"/>
</target>

The taskdef definition must occur only once per ant-build file and can appear anywhere on the top level below the project element.

Note that it is not possible to copy the ant.jar archive to the lib folder of your ant distribution. You have to reference a full installation of install4j in the task definition.

The createbundle task supports the following parameters:

 
AttributeDescriptionRequired
javahomeThe home directory of the JRE that should be bundledYes
outputDirectoryThe output directory Corresponds to the --output command line option described above.
version Corresponds to the --version command line option described above. No
id Corresponds to the --id command line option described above. No
unpacked Corresponds to the --unpacked command line option described above. No
jdkRelease Corresponds to the --jdk-release command line option described above. No
jdkProviderId Corresponds to the --jdk-provider-id command line option described above. No
addModules Corresponds to the --add-modules command line option described above. No
addModuleSet Corresponds to the --add-module-set command line option described above. No
addJmod Corresponds to the --add-jmod command line option described above. No
addJmodDir Corresponds to the --add-jmod-dir command line option described above. No

Example:

<createbundle javahome="/usr/lib/jvm/jre-11/jre"
              output="/home/build/projects/myproject/jrebundles"
              version="11"
              id="j3d"
/>