Topics and trends related to the Java ecosystem with occasional random rants.

  • Sun
    March 10, 2014

Introducing the EJDK

James Connors
Principal Solutions Consultant

In lock step with the introduction of Compact Profiles, Java 8 includes a new distribution mechanism for Java SE Embedded called the EJDK.  As the potential exists to confuse the EJDK with the standard JDK (Java Development Kit), it makes sense to dedicate a few words towards highlighting how these two packages differ in form and function.


The venerable Java Development Kit is the mainstay of Java developers.  It incorporates not only a standard Java Runtime Environment (JRE), but also includes critical tools required by those same developers.  For example, among many others, the JDK comes with a Java compiler (javac), a Java console application (jconsole), the Java debugger (jdb) and the Java archive utility (jar).  It also serves as the underpinnings for very popular Java Integrated Development Environments (IDEs) such as NetBeans, Eclipse, JDeveloper and IntelliJ to name a few.

Like Java, the Java Development Kit is constantly evolving, and Java 8 brings about its fair share of enhancements to the JDK.  For Java 8, javac can now be instructed (via the -profile command-line option) to insure that your source code is compatible with a specific compact profile.  Furthermore, the Java 8 JDK comes with a new useful tool called jdeps, providing a means to analyze your compiled class and jar files for dependencies.


The EJDK is new to Java 8, and although similar in namesake to the JDK, it serves quite a different purpose.  Prior to Java 8, supported Java SE-Embedded runtime platforms were provided as binaries by Oracle.  With the advent of Compact Profiles, the number of possible binary options per supported platform would simply be too unweildy.  Rather than furnishing binaries for each of the possible combinations, an EJDK will be supplied for each supported Java SE-Embedded platform.  It contains the tools needed to create the profile you wish to use.

The EJDK is designed to be run with either Windows or Linux/Unix platforms alongside a Java runtime environment.  It contains a wrapper called jrecreate (jrecreate.sh for Unix/Linux and jrecreate.bat for Windows) whose function it is to create deployable compact profile instances. In the examples that follow, we'll show two sample invocations.

First off, let's briefly take a look at the contents of a typical EJDK.   For our first example, we've installed the EJDK on a linux/x86 system.   Listing the contents of the ejdk1.8.0/ directory, we see a subdirectory named linux_arm_vfp_hflt/.  This tells us what platform this instance of the EJDK supports.  For all our examples we'll use an EJDK that creates compact profiles suitable for Linux/Arm Hard Float platform, often times referred to as armhf.

$ ls ejdk1.8.0
bin  doc  lib  linux_arm_vfp_hflt

Looking one level deeper into the bin/ directory, we see the jrecreate.bat and jrecreate.sh files:

$ ls ejdk1.8.0/bin
jrecreate.bat  jrecreate.config.properties  jrecreate.sh

As we're on a Linux system, let's use the jrecreate.sh script to create a compact profile:

$ ./ejdk1.8.0/bin/jrecreate.sh --profile compact1 --dest compact1-minimal --vm minimal

Briefly reviewing this invocation, the --profile compact1 option instructs jrecreate to use the Compact1 profile.  The --profile option accepts [compact1 | compact2 | compact3]  as an argument. The --dest compact1-minimal option specifies the name of the destination directory containing the newly generated profile.  Note that the directory argument to --dest must not exist prior to invocation.  Finally, the --vm minimal option tells jrecreate to use the minimal (i.e. the smallest) virtual machine for this instance.  The --vm option accepts  [minimal | client | server | all] as an argument.  Running the complete jrecreate.sh command, we get the following output:

$ ./ejdk1.8.0/bin/jrecreate.sh --profile compact1 --dest compact1-minimal --vm minimal
Building JRE using Options {
   ejdk-home: /home/java8/ejdk1.8.0
    dest: /home/java8/compact1-minimal
    target: linux_arm_vfp_hflt
    vm: minimal
    runtime: compact1 profile
    debug: false
    keep-debug-info: false
    no-compression: false
    dry-run: false
    verbose: false
    extension: []

Target JRE Size is 10,595 KB (on disk usage may be greater).
Embedded JRE created successfully

This creates a Compac1 profile distribution of about 10 ½ MB in the compact-1-minimal/ directory.  For our second example, we'll create a profile based on Compact2 and the client VM, this time from a Windows 7/64-bit system:

c:\demo>ejdk1.8.0\bin\jrecreate.bat --profile compact2 --dest compact2-client --vm client
Building JRE using Options {
    ejdk-home: c:\demo\ejdk1.8.0\bin\..
    dest: c:\demo\compact2-client
    target: linux_arm_vfp_hflt
    vm: client
    runtime: compact2 profile
    debug: false
    keep-debug-info: false
    no-compression: false
    dry-run: false
    verbose: false
    extension: []

Target JRE Size is 17,552 KB (on disk usage may be greater).
Embedded JRE created successfully

This Compact2 instance is created in the compact2-client/ directory and has an approximate footprint of 17 ½ MB.  Additional options to jrecreate are available for further customization.

Finally, lets migrate the generated profiles over to a real device.  As a host platform we'll use none other than the ubiquitous Raspberry Pi.  Here's a listing of the two profiles and their size (in 1K blocks) on the filesystem:

pi@pi0 ~/java8 $ ls
compact1-minimal  compact2-client

pi@pi0 ~/java8 $ du -sk compact*
10616   compact1-minimal
17660   compact2-client

And here's what each version outputs when java -version is run:

pi@pi0 ~/java8 $ ./compact1-minimal/bin/java -version
java version "1.8.0"
Java(TM) SE Embedded Runtime Environment (build 1.8.0-b127, profile compact1, headless)
Java HotSpot(TM) Embedded Minimal VM (build 25.0-b69, mixed mode)

pi@pi0 ~/java8 $ ./compact2-client/bin/java -version
java version "1.8.0"
Java(TM) SE Embedded Runtime Environment (build 1.8.0-b127, profile compact2, headless)
Java HotSpot(TM) Embedded Client VM (build 25.0-b69, mixed mode)

In conclusion, you are encouraged to experiment with the EJDK.  It will very quickly give you a feel for the compact profile configuration options available for your device.

Join the discussion

Comments ( 7 )
  • guest Sunday, March 23, 2014

    Thanks for the post. How do I get the jrecreate.bat command on WIndows? I do not see any EJDK download for Windows.

  • Jim Connors Monday, March 24, 2014

    That's because there is nio EJDK for Windows. The EJDK is the distribution mechanism for Java SE-Embedded runtime environments. As of this reply, the following platforms are supported:

    ARMv7 Linux VFP Hard Float

    ARMv6/7 Linux VFP Soft Float

    ARMv5 Linux Soft Float

    PowerPC e600 Linux Classic Floating Point

    PowerPC e500v2 Linux SPE Floating Point

    x86 Linux

  • darkcg Friday, April 25, 2014

    So, actually, a modular JVM doesn't exist for regular x86 windows machines, right?

  • Jim Connors Friday, April 25, 2014

    Correct, Compact Profiles are a fundamantal part of Java SE-Embedded, however if you're ambitious you can build an OpenJDK version from source. An additional blog entry: https://blogs.oracle.com/jtc/entry/compact_profiles_demonstrated, says the following:

    "It's not as intimidating as it sounds, you can pull down the source code for OpenJDK 8, and build it yourself. By default, compact profiles are not built, but this forum post (http://mail.openjdk.java.net/pipermail/jdk8-dev/2013-February/002062.html)shows you how. The reference platform for this software is linux/x86. Functionally, the generated compact profiles will contain the pared down modules for each compact profile, but you'll find the footprint for each to be much larger than the ones demonstrated in this video, as none of the Java SE-Embedded space optimizations are performed by default."

  • Hydreliox Monday, October 27, 2014

    I'm trying to install java on an ARM v5 platform (Debian). I've extracted the ejdk on /opt/java/ folder.

    But when i'm trying to launch the install script, there is this message :

    ./jrecreate.sh: 12: /opt/java/bin/java: not found

    Can someone help me ? I need Java 8 on this machine and not other version.

    Thank you for helping noob ;-)

  • Jim Connors Tuesday, October 28, 2014

    Looking back on this entry, it may not be entirely clear that in order to use the eJDK, you must also have a Java Runtime Environment installed on the same system as the eJDK (not the target system). The jrecreate.sh script actually starts up a Java program to generate Compact Profiles.

    First suggestion is to (1) check to see that you have a JRE installed, (2) that the 'java' executable is in your PATH and (3) the JAVA_HOME variable is set accordingly. For example:

    $ echo $PATH


    $ java -version

    java version "1.7.0_55"

    Java(TM) SE Runtime Environment (build 1.7.0_55-b13)

    Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

    $ echo $JAVA_HOME


  • hydreliox Wednesday, October 29, 2014

    Thank you for your response. I found a complete solution using this tutorial :


    Combined with yours, I have now a usable Java8 JRE on my ARM platform.

    Thank you again

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.