DENX . DULG . AN2014_03_JavaOnELDK

Adding support for JAVA to ELDK


This document was written by Stefano Babic (sbabic {at} denx {dot} de). -- StefanoBabic - 17 Apr 2014


ELDK does not deliver ready to use images with Java support. However, because ELDK is based on the Yocto build system, it is very easy to add Java support to it. Zhis howto explains how to add Java to the ELDK/QT image.

Applying patches

To start, you need to apply the patches in the attachment. Patches were initially prepared for ELDK-5.3, but they were tested for later release as well. I tested myself with ELDK-5.5.

After cloning the ELDK's sources, you can prepare a branch for java:

git checkout -b eldk-5.5-java eldk-5.5
git am 0001-Java-support-for-eldk-5.3-armv7a-Vybrid-VF6xx.patch
git am 0002-Java-support-for-eldk-5.3-armv7a-Vybrid-VF6xx.patch

The patches add the giflib library and simply adds java to core-image-qte-sdk.In fact, the following packages are installed:

             openjdk-7-common  \
             openjdk-7-java    \
             openjdk-7-jre     \
             openjdk-7-vm-cacao        \
             icu                       \

Set up the build system

As usual, it is required to configure the build system before starting. First at all, a new build directory, if it was not yet created, must be generated.

. oe-init-build-env <your-build-name>

For example:

. oe-init-build-env eldk-5.5-java

Now the configuration file must be set. All receipes for java are in the meta-java layer, available at git:// You must to add this layer to your bblayers.conf file. Go into your build directory, and change bblayers adding meta-java to the list. As reference, this is my bblayers.conf:

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly


  /home/stefano/Projects/eldk/meta \
  /home/stefano/Projects/eldk/meta-yocto \
  /home/stefano/Projects/eldk/meta-yocto-bsp \
  /home/stefano/Projects/eldk/meta-eldk \
  /home/stefano/Projects/meta-projects/meta-java \
  /home/stefano/Projects/eldk/meta \
  /home/stefano/Projects/eldk/meta-yocto \

You need also to change local.conf for openJDk. I added the following items in my local.conf:

# Java build settings
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
#PREFERRED_VERSION_openjdk-7-jre = "03b21-2.1.8"
PREFERRED_VERSION_openjdk-7-jre = "25b30-2.3.12"
PREFERRED_VERSION_icedtea7-native = "2.1.3"
PREFERRED_PROVIDER_openjdk-7-jre = "openjdk-7-jre"

Build the image

You can run now bitbake to start the build. Select your machine, if you have not your, and start bitbake. For example, using generic-armv7a:

MACHINE=generic_armv7a bitbake core-image-java-qte-sdk

At the end of the compilation, the images are in the tmp/deploy/images directory. You can test the image in the way you are used to, copying it into internal target's storage or putting it on a NFS Server.

Simple test

This HowTo? cannot be declared completed if a "Hello World !" is Java does not run on the target.

public class HelloWorld {

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

Not a lot, but at least to see java running. You can compile it on your host:


and copy it on the target's root filesystem. You are then able to run it:

root@generic-armv7a:~# java HelloWorld
Hello World!

root@generic-armv7a:~# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.12) (25b30-2.3.12)
OpenJDK Zero VM (build 23.7-b01, mixed mode)


Attachment sort Action Size Date Who Comment
0001-Java-support-for-eldk-5.3-armv7a-Vybrid-VF6xx.patch manage 1.2 K 17 Apr 2014 - 10:16 StefanoBabic Add giflib library
0002-Java-support-for-eldk-5.3-armv7a-Vybrid-VF6xx.patch manage 1.4 K 17 Apr 2014 - 10:17 StefanoBabic Add Java to qte image

----- Revision r1.1 - 17 Apr 2014 - 10:05 - StefanoBabic
Copyright © 2002-2018 by DENX Software Engineering