Eclipse OpenJ9
Eclipse Incubation

Build your own OpenJDK

Building OpenJDK™ 8 with OpenJ9 will be familiar to anyone who has already built OpenJDK.
We're going to use Docker to create a Docker container where you'll build a binary from source code and run some tests on it. Just follow these steps:

Prepare your system

We'll start by building a Dockerfile.

Note: The Dockerfile you'll use in these instructions creates the configuration that makes building OpenJDK with OpenJ9 very simple. If you don't want to use Docker or you want to build a binary for another platform, you'll need to reproduce the configuration for yourself. Read the full set of build instructions for JDK 8 to see what you'll need (including Apache FreeMarker™) and where to get it.

If you don't already have Docker on your system, download and install it now.

Pick one of the following JDK v8 Dockerfiles for the platform you want to work on:

Save the Dockerfile to your current directory and specify these commands to build and run the Docker image:

docker build -t openj9 -f Dockerfile .
docker run -it openj9

Depending on your Docker system configuration, you might need to prefix these commands with sudo.

Now that you have the Docker image running, you are ready to move to the next step.

Get the source

First you need to clone the Extensions for OpenJDK for Eclipse OpenJ9 project.

This repository is a git mirror of OpenJDK without the HotSpot JVM, but with an openj9 branch that contains a few necessary patches. Run the following command:

git clone https://github.com/ibmruntimes/openj9-openjdk-jdk8

Cloning this repository can take a while because OpenJDK is a large project! When the process is complete, change directory into the cloned repository:

cd openj9-openjdk-jdk8

Now fetch additional sources from the Eclipse OpenJ9 project and its clone of Eclipse OMR:

bash ./get_source.sh

Configure

When you have all the source files that you need, run the configure script, which detects how to build in the current build environment. You must specify one extra jar file, which has already been installed into the Docker container.

bash ./configure --with-freemarker-jar=/root/freemarker.jar

Note that you must give an absolute path to freemarker.jar

Build

Now you're ready to build OpenJDK with OpenJ9:

make all

Two Java™ builds are produced: a full developer kit (jdk) and a runtime environment (jre):

  • build/<platform>/images/j2sdk-image
  • build/<platform>/images/j2re-image

where <platform> reflects the Dockerfile you chose.

For example, the Linux 64-bit (x86-64) Dockerfile directory is: linux-x86_64-normal-server-release

Test

For a simple test, try running the java -version command.

cd build/<platform>/images/j2re-image
./bin/java -version

Here is a sample of the output from a Linux x-86 binary:

openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-admin_2017_10_31_10_46-b00)
Eclipse OpenJ9 VM (build 2.9, JRE 1.8.0 Linux amd64-64 Compressed References 20171031_000000 (JIT enabled, AOT enabled)
OpenJ9   - 68d6fdb
OMR      - 7c3d3d7
OpenJDK  - 27f5b8f based on jdk8u152-b03)

There are a large number of test cases that are run automatically as part of the Eclipse OpenJ9 build and test pipeline. The tests are triggered by pull requests and by successful OpenJ9 builds. You can see the latest results on the Eclipse OpenJ9 Jenkins instance.

If you want to run any of these tests manually on your own machine, refer to the OpenJ9 test quick start guide.

Building OpenJDK™ 11 with OpenJ9 will be familiar to anyone who has already built OpenJDK.
We're going to use Docker to create a Docker container where you'll build a binary from source code and run some tests on it. Just follow these steps:

Prepare your system

We'll start by building a Dockerfile.

Note: The Dockerfile you'll use in these instructions creates the configuration that makes building OpenJDK with OpenJ9 very simple. If you don't want to use Docker or you want to build a binary for another platform, you'll need to reproduce the configuration for yourself. Read the full set of build instructions for JDK 11 to see what you'll need (including Apache FreeMarker™) and where to get it.

If you don't already have Docker on your system, download and install it now.

Pick one of the following JDK v11 Dockerfiles for the platform you want to work on:

Save the Dockerfile to your current directory and specify these commands to build and run the Docker image:

docker build -t openj9 -f Dockerfile .
docker run -it openj9

Depending on your Docker system configuration, you might need to prefix these commands with sudo.

Now that you have the Docker image running, you are ready to move to the next step.

Get the source

First you need to clone the Extensions for OpenJDK for Eclipse OpenJ9 project.

This repository is a git mirror of OpenJDK without the HotSpot JVM, but with an openj9 branch that contains a few necessary patches. Run the following command:

git clone https://github.com/ibmruntimes/openj9-openjdk-jdk11

Cloning this repository can take a while because OpenJDK is a large project! When the process is complete, change directory into the cloned repository:

cd openj9-openjdk-jdk11

Now fetch additional sources from the Eclipse OpenJ9 project and its clone of Eclipse OMR:

bash ./get_source.sh

Configure

When you have all the source files that you need, run the configure script, which detects how to build in the current build environment. You must specify one extra jar file, which has already been installed into the Docker container.

bash ./configure --with-freemarker-jar=/root/freemarker.jar

Note that you must give an absolute path to freemarker.jar

Build

Now you're ready to build OpenJDK with OpenJ9:

make all

A full developer kit (jdk) is produced in the following directory: build/<platform>/images/jdk

where <platform> reflects the Dockerfile you chose.

For example, the Linux 64-bit (x86-64) Dockerfile directory is: linux-x86_64-normal-server-release

Test

For a simple test, try running the java -version command.

cd build/<platform>/images/jdk
./bin/java -version

Here is a sample of the output from a Linux x-86 binary:

openjdk version "11-internal" 2018-09-25
OpenJDK Runtime Environment (build 11-internal+0-adhoc..jdk11)
Eclipse OpenJ9 VM (build master-ee517c1, JRE 11 Linux amd64-64-Bit Compressed References 20180910_000000 (JIT enabled, AOT enabled)
OpenJ9   - ee517c1
OMR      - f29d158
JCL      - 98f2038 based on jdk-11+28)

There are a large number of test cases that are run automatically as part of the Eclipse OpenJ9 build and test pipeline. The tests are triggered by pull requests and by successful OpenJ9 builds. You can see the latest results on the Eclipse OpenJ9 Jenkins instance.

If you want to run any of these tests manually on your own machine, refer to the OpenJ9 test quick start guide.

Building OpenJDK™ 12 with OpenJ9 will be familiar to anyone who has already built OpenJDK.
We're going to use Docker to create a Docker container where you'll build a binary from source code and run some tests on it. Just follow these steps:

Prepare your system

We'll start by building a Dockerfile.

Note: The Dockerfile you'll use in these instructions creates the configuration that makes building OpenJDK with OpenJ9 very simple. If you don't want to use Docker or you want to build a binary for another platform, you'll need to reproduce the configuration for yourself. Read the full set of build instructions for JDK 12 to see what you'll need (including Apache FreeMarker™) and where to get it.

If you don't already have Docker on your system, download and install it now.

Pick one of the following JDK v12 Dockerfiles for the platform you want to work on:

Save the Dockerfile to your current directory and specify these commands to build and run the Docker image:

docker build -t openj9 -f Dockerfile .
docker run -it openj9

Depending on your Docker system configuration, you might need to prefix these commands with sudo.

Now that you have the Docker image running, you are ready to move to the next step.

Get the source

First you need to clone the Extensions for OpenJDK for Eclipse OpenJ9 project.

This repository is a git mirror of OpenJDK without the HotSpot JVM, but with an openj9 branch that contains a few necessary patches. Run the following command:

git clone https://github.com/ibmruntimes/openj9-openjdk-jdk12

Cloning this repository can take a while because OpenJDK is a large project! When the process is complete, change directory into the cloned repository:

cd openj9-openjdk-jdk12

Now fetch additional sources from the Eclipse OpenJ9 project and its clone of Eclipse OMR:

bash ./get_source.sh

Configure

When you have all the source files that you need, run the configure script, which detects how to build in the current build environment. You must specify one extra jar file, which has already been installed into the Docker container.

bash ./configure --with-freemarker-jar=/root/freemarker.jar

Note that you must give an absolute path to freemarker.jar

Build

Now you're ready to build OpenJDK with OpenJ9:

make all

A full developer kit (jdk) is produced in the following directory: build/<platform>/images/jdk

where <platform> reflects the Dockerfile you chose.

For example, the Linux 64-bit (x86-64) Dockerfile directory is: linux-x86_64-normal-server-release

Test

For a simple test, try running the java -version command.

cd build/<platform>/images/jdk
./bin/java -version

Here is a sample of the output from a Linux x-86 binary:

openjdk version "12-internal" 2019-03-19
OpenJDK Runtime Environment (build 12-internal+0-adhoc..openj9-openjdk-jdk12)
Eclipse OpenJ9 VM (build tye-2e3d778, JRE 12 Linux amd64-64-Bit Compressed References 20190201_000000 (JIT enabled, AOT enabled)
OpenJ9   - 2e3d778
OMR      - a5a028d
JCL      - 9af014f based on jdk-12+29)

There are a large number of test cases that are run automatically as part of the Eclipse OpenJ9 build and test pipeline. The tests are triggered by pull requests and by successful OpenJ9 builds. You can see the latest results on the Eclipse OpenJ9 Jenkins instance.

If you want to run any of these tests manually on your own machine, refer to the OpenJ9 test quick start guide.