Thursday, January 17, 2019

Building your own JDK distributions

Everyone started to talk about openJDK[1] with the new licensing that Oracle introduced in January 2019. According to Oracle[2] public updates for Java SE8[3] will be available until the end of 2020 for individual personal use but not for business, commercial or production use[4].

 This lead people to look into alternative JDK distributions. AdoptOpenJDK[5] and AWS Corretto [6] seems to be good options. However, by the time this post is written, AWS Corretto still in its preview state.

By the way, the aim of this post is not to talk about other OpenJDK distributions but to build your JDK distribution.

Let's get our hands dirty.
Hmmmmm, no, you don't have to get your hands dirty. I have made it super simple for you :). I have made a docker image[7] which contains all the necessary dependent tools and libraries. Just follow the below mantioned steps and you will have your own OpenJDK distribution.

Note: Install Docker[1], if you haven't done it yet.

1. Pull the docker image

docker pull jsdjayanga/ubuntu-openjdk8-build

2. Spin up a container with the above image

docker run -it jsdjayanga/ubuntu-openjdk8-build

3. Go to source the directory

cd jdk8u

4. Checkout the tag

hg checkout jdk8u192-b12

5. Run the configure. You can set your name as the release user if you wish by setting --with-user-release-suffix

bash configure --enable-unlimited-crypto --with-user-release-suffix=jsdjayanga --with-build-number=b01 --with-milestone=192

6. Create images

make images

This process would take 30min to 1h and finally, you have your own OpenJDK distribution in the following location.

/jdk8u/build/linux-x86_64-normal-server-release/images

Try this is out and share your experience :)


[1] https://openjdk.java.net/
[2] https://www.oracle.com/index.html
[3] https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 
[4] https://java.com/en/download/release_notice.jsp
[5] https://adoptopenjdk.net/
[6] https://aws.amazon.com/corretto/
[7] https://hub.docker.com/r/jsdjayanga/ubuntu-openjdk8-build