Documentation



Oracle Java SE Embedded: Developer's Guide

8 Create Your JRE with jrecreate

This chapter describes how to create your Java Runtime Environments with the jrecreate tool.

This chapter contains the following topics:

Running jrecreate

You must run jrecreate on the host computer, then copy over the resulting JRE to the embedded device.

Note:

jrecreate needs approximately 1 GB of free memory to run.

jrecreate Command Syntax

jrecreate --dest host-destination-directory [options]

jrecreate Options

Options can be specified in any order. Only one option is required, the directory into which jrecreate writes the JRE.

Note that double hyphens precede the long form of all options.

Note:

The ARM Swing/AWT configuration of Oracle Java SE Embedded does not support all jrecreate options. See Configuring the JRE for Swing/AWT Headful Applications.

-h
--help

Optional. Use as the only option when you need a summary of the command-line options.

-d path
--dest path

Required. Directory in which to write the JRE image and related files. The directory must not exist.

-p profile
--profile profile

Optional. Default: full JRE APIs.

Creates a JRE whose APIs are based on a specified profile (see About Compact Profiles). The valid values are one of the following:

  • compact1

  • compact2

  • compact3

--vm jvm

Optional. If neither --vm nor --profile is specified, all available JVMs are included in the JRE.

Creates a JRE that has a particular Java Virtual Machine (JVM) or all JVMs. See About Oracle Java SE Embedded JVMs. The valid values are one of the following:

  • minimal

  • client

  • server (if available for the target computer)

  • all (all available for the target computer)

To learn how the java program launcher chooses a JVM when multiple JVMs are available, see Launch the Application with the java Launcher Tool.

If you do not specify the --vm option, then the jrecreate command uses the value of the --profile option to select a JVM as follows:

  • compact1: minimal

  • compact2: minimal

  • compact3: client

-x extension [,extension ...]
--extension extension [,extension ...]

Optional. Default: no extensions

Adds optional components to a JRE. With the exceptions noted below, you can use the components in any combination and with all profiles and JVMs.

You can specify multiple extensions in either of the following ways:

  • Multiple option instances:
    --extension sunec \
    --extension sunpkcs11

  • Comma separated list of extensions:
    --extension sunec,sunpkcs11

Valid --extension Values 

-g
--debug

Optional. Default: no debug support.

Creates a JRE that contains debugging support, including Java Virtual Machine Tool Interface (JVMTI) support for inspecting and controlling an application.

Notes on the --debug component:

  • This option is not valid for the minimal JVM. If that combination is specified, then the jrecreate command selects the client JVM.

  • Some debugging functionality requires that the java command be run with the -XX:+UsePerfData flag. By default in Oracle Java SE Embedded, this flag is turned off.

-k
--keep-debug-info

Optional. Default: no debugging information.

Does not strip debugging information from class and unsigned JAR files. This option increases the size of some JRE files for easier debugging.

--no-compression

Optional. Default: compressed JAR files.

Creates a JRE whose unsigned JAR files are created in an uncompressed format. This option trades increased footprint for potentially improved startup time. Experiment to see if the option is beneficial in your environment.

-n
--dry-run

Optional. Default: create the JRE.

Generates a descriptive report without creating a JRE image.

-v
--verbose

Optional. Default: terse output.

Displays verbose output, including the commands that the jrecreate command invokes. This option is helpful for debugging.

--ejdk-home path

Optional. Default: value of EJDK_HOME environment variable if set; otherwise /ejdk<version>

Directory that contains the Oracle Java SE Embedded runtime components to use in the custom JRE. Use this option when you have multiple Oracle Java SE Embedded installations and you want to run the jrecreate command in installation1 but build a JRE with components from installation2. For example, installation1 might be contain ARM components, and installation2 might contain x86 components.

jrecreate Command Examples

The following example show how the jrecreate options are used to create some common custom JREs.

The installDir variable represents the host directory where Oracle Java SE Embedded is installed.

Example 1   

Smallest JRE: headless, compact1 profile, minimal JVM (default for compact1).

% installDir/ejdk<version>/bin/jrecreate.sh \
--profile compact1 \
--dest /tmp/defaultJRE/
Example 2   

compact2 profile, client JVM with debugging support.

% installDir/ejdk<version>/bin/jrecreate.sh \
    --dest /tmp/exampleJRE1/ \
    --profile compact2 \
    --vm client \ 
    --keep-debug-info \
    --debug
Example 3   

JavaFX controls and Java SE locales added to server JVM and compact3 profile.

% installDir/ejdk<version>/bin/jrecreate.sh \
    --dest /tmp/exampleJRE2 \
    --profile compact3 \
    --vm server \
    --extension fx:controls \
    --extension locales 
Example 4   

Full JRE APIs, all JVMs (default).

% installDir/ejdk<version>/bin/jrecreate.sh \
    --dest /tmp/exampleJRE3 

jrecreate Command Output

When it begins to run, the jrecreate command displays a summary of the options used to build the JRE, for example:

Building JRE using options Options {
    ejdk-home: /home/xxxx/ejdk/ejdk<version>
    dest: /tmp/testjre
    target: linux_i586
    vm: minimal
    runtime: compact1 profile
    debug: false
    keep-debug-info: false
    no-compression: false
    dry-run: false
    verbose: false
    extension: []
}

JRE Directories

After the command completes, the destination (--dest) directory on the host may contain the following directories, depending on which components are included in the JRE:

  • bin/: Target-native commands, minimally including the java JRE application launcher. The complement of tools varies according to the value of the --profile option.

  • lib/: The files that make up the core of the JRE, including classes, JVMs, time zone information, and other resources.

  • release: A text file that tools can read to obtain attributes of the generated JRE, such as the Java version, profile name (if applicable), operating system name, and CPU architecture.

  • bom: A text file that documents how the JRE was created, including the jrecreate command options and the files that the command used.

  • COPYRIGHT, LICENSE, README, THIRDPARTYLICENSEREADME.txt: Legal and other documentation. Present only if --profile is not specified (full JRE APIs).

Configuring the JRE for Swing/AWT Headful Applications

The ARM AWT/Swing configuration of Oracle Java SE Embedded supports the Swing and AWT graphics APIs if you need to run Swing/AWT applications. Consult Oracle Java SE Embedded System Requirements for the platforms that support headful Swing/AWT applications.

To install the Swing/AWT APIs, you must create a full JRE by using the jrecreate command without the --profile option. With a full JRE, you can install the client VM (the --vm client option), the server VM (the --vm server option) or both (the --vm all option, or leave the --vm option unspecified). The minimal VM is not supported.

If you plan to run both AWT/Swing and JavaFX applications on a target that supports both AWT/Swing and JavaFX, you can add JavaFX APIs by adding the --extension option with fx:graphics or fx:controls. To keep the footprint small, only install the JavaFX APIs when you know that you will be running JavaFX applications.

Note:

An application can only make calls to the Swing/AWT API or the JavaFX API, not both.

Close Window

Table of Contents

Oracle Java SE Embedded: Developer's Guide

Expand | Collapse