Oracle Java SE Embedded: Developer's Guide

2 Quick Start for Platform Developers

Learn how to get your embedded devices running with the minimal JRE required for your device, plus the embedded applications you plan to run.

This chapter contains the following topics:


Java SE Embedded has the tools to enable you to install custom JREs on the target device. The job of a platform developer is to determine which JRE components are required for the device and for the applications that will run on the device. See About Custom JREs.

Quick Start Example

This section will walk you through a simple example of how to set up a JRE on your embedded device and deploy your Java applications.

Let's suppose that you have a typical setup:

  • A host computer running Linux

  • An embedded device with Linux installed

  • An Oracle Java SE Embedded bundle that matches the embedded device's hardware and operating system

You want to put a JRE on your embedded device that will have the correct compact profile and JVM to run the two example headless applications shown here.

Here are the basic tasks that a platform developer would be likely to face in deciding which JRE to install on their embedded device.

The next section shows a simple example of how to accomplish these tasks.


In most cases, embedded devices run headless applications (no user interface). The Hello World and Hello RMI applications used as examples in this guide are headless applications.

Headful applications (with a UI) are developed using the JavaFX APIs in the Java Development Kit (JDK). If you are working with headful applications, see the appendix Preparing a Device for JavaFX.

This scenario is very simple. For more information and more options, see the More Information links at the end of each section.

Task 1   Install Oracle Java SE Embedded on your host computer

Download and set up Oracle Java SE Embedded on a host computer.

  1. Download the Oracle Java SE Embedded bundle from

  2. Extract the bundle from the tar file:

    $ cd download 
    $ gunzip *.gz
    $ tar -xvf *.tar 
    List of unpacked files ... 
  3. Set the following environment variables:

    • Set EJDK_HOME to download/ejdk1.8.0_06

    • If not already set, define value of JAVA_HOME as the path of the local Java SE installation.

  4. Verify the installation:

    $ cd $EJDK_HOME
    $ bin/ --help
    Usage: jrecreate --help
    Summary of jrecreate syntax ...  

More Information:

Task 2   Determine which profile to use for your applications

Use the Java jdeps tool across all of your platform applications to determine the minimal compact profile to install on your device: compact1, compact2, or compact3.

You can use the jdeps command to determine the minimal compact profile you can use. To illustrate the use of the jdeps command, let's take two simple headless application examples: Hello World and Hello RMI.

In the Hello World example, shown in Example 2-1, the application merely prints "Hello World" to the console.

Example 2-1 Hello World Application

public class HelloWorld {
  public static void main (String args[]) {
    System.out.println("Hello world!");

In the Hello RMI example, shown in Example 2-2, the application uses the RMI LocateRegistry class to access a remote object and print a stack trace if there is an error.

Example 2-2 Hello RMI Application

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class HelloRMI {
  public static void main (String args[]) {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new SecurityManager());
    try {
      Registry registry = LocateRegistry.getRegistry("testRMI");
      System.out.println("Hello RMI!");
      } catch (Exception e) {
        System.err.println("RMI exception:");

Let's also assume that both of your applications have been compiled. If you want to compile either of the example applications, the compile commands are shown in Example 2-3.

Example 2-3 Compile Commands for Hello World and Hello RMI

% javac
% javac

Now you can use the jdeps tool to determine the minimum compact profile required to run each application. Example 2-4 show the command and results for the Hello World application.

Example 2-4 jdeps Command and Results for the Hello World Application

% jdeps -P HelloWorld.class
HelloWorld.class -> /net/
   <unnamed> (HelloWorld.class)
      ->                                            compact1
      -> java.lang                                          compact1

The results in Example 2-4 show that the compact1 profile is the minimal profile required to run the Hello World application.

Example 2-5 shows the command results for the Hello RMI application.

Example 2-5 jdeps Command and Results for the Hello RMI Application

% jdeps -P HelloRMI.class
HelloRMI.class -> /net/
   <unnamed> (HelloRMI.class)
      ->                                            compact1
      -> java.lang                                          compact1
      -> java.rmi.registry                                  compact2

The results in Example 2-5 show that the java.rmi.registry class in the Hello RMI application minimally require the compact2 profile.

More Information:

Task 3   Determine which JVM to use

Choose which version of the JVM you want to install, based on which performance characteristics are most important: minimal, client, or server.

Choose the JVM based on which performance characteristics are most important for running your applications. In a nutshell, the three Java SE Embedded JVMs have the following performance characteristics:

Table 2-1 JVM Versions and Their Primary Performance Characteristics

JVM Version Primary Performance Characteristics


Minimal memory footprint




Tuned for long-running applications

In this example, let's try out the minimal JVM, which has the smallest footprint, and upgrade to a higher JVM if we are not happy with performance.

More Information:

Task 4   Use jrecreate to create the JRE

Since we have chosen the profile and the VM to install, we can now install the JRE to a temporary directory on the host computer using the jrecreate command, which is included in the bin folder of the extracted Java SE Embedded bundle.

Run the following command on the host computer:

% download/ejdk1.8.0_06/bin/ \
     --profile compact1 \
     --dest /tmp/defaultJRE/

More Information:

Task 5   Deploy the JRE to the embedded device

To deploy the JRE, simple copy the JRE files that you created with the jrecreate command over to the embedded device. How you copy depends on how whether you use the network or an SD card, but here is an example of a copy command:

scp -r /tmp/defaultJRE/* root@target:/opt/local/ejdk1.8.0_06/

More Information:

Task 6   Deploy your embedded applications to the device

If you have compiled the Hello World and Hello RMI applications, you can try copying them over and running them on your embedded device. Or, you can try copying over an application of your own.

More Information:

Close Window

Table of Contents

Oracle Java SE Embedded: Developer's Guide

Expand | Collapse