Sunday, December 29, 2019

Replacing Your Oracle JDK with an Open Source Alternative

Oracle says that Java is still free. That is a true statement given that the platform is still developed and distributed free of charge at Oracle's web site. What is not free anymore is using Oracle's distribution outside of the update cycle. You can still use the Oracle JDK freely if you always stick to the latest supported version. This essentially mean you have to update the JDK you use every 6 months, even if the release is an LTS (Long Term Support) release. If you do not do  this then you have to pay Oracle for support. It is also not an options to just keep running on the unsupported version without any upgrades, this is still a violation of Oracle's terms and conditions. Updating to a major release every 6 months is not a tempo that most projects can sustain. Just getting the tooling to follow suit will drain the energy out of most projects. Luckily there are alternatives to using the Oracle distribution and this is why Java truly still is free. I will go through some of the alternatives here and give you my take on what to select.

I have only selected to talk about ones that are actually free in production, other like Red Hat JDK are free but only for development, for production you need a support agreement with Red Hat. This does not mean that it would not be a good choice for you, especially if you already have a support agreement with Red Hat, but I am focusing on free as in beer. The alternatives I will talk about are the following:

The first thing that should be noted when talking about these alternatives is that they all build on the same source code. They are all based on the OpenJDK project so there are no feature differences between the distributions. What varies is what parts are built into the distribution, platforms, release cycle and installers.



Amazon Corretto Azul Zulu AdoptOpenJDK OpenJDK
Versions Available LTS versions, currently Java 8 and 11. LTS versions and latest version of java, currently Java 8, 11 and 13. All versions of Java from 8 and on. All versions of Java from 8 and on.
Platforms Supported Windows (x86, x64), Linux (x64, aarch64), macOS (x64) Windows (x86 64-bit), Linux (x86 64-bit, ARM 64/32-bit), macOS (x86 64-bit) Windows (x86, x64), Linux (x64, arm32, aarch64, ppc64le, s390x), macOS (x64), AIX (ppc64) Build it yourself and it will (likely) work.
Docker Support Yes, Linux only. Smallest image is around 250MB. Yes, Linux only. Smallest image is around 55MB. Yes, there are images for all platforms including windows. Smallest image is around 80MB. You can build your own docker image.
Installers MSI, PKG, RPM, Deb and ZIP/Tar MSI, DMG, RPM, Deb and ZIP/Tar MSI, PKG and ZIP/Tar Zip/Tar
Support Available via AWS Support Plan. Can be purchased with Azul. Can be purchased with IBM. No Support.
Release Cycle Quaterly with possible out of cycle releases for serious issues (e.g. security). Quaterly. Quaterly. When ever you build a new release.
Components No OpenJFX included. OpenJFX downloaded and installed separately. No OpenJFX included. OpenJFX needs to be built separately.

I've mainly included the OpenJDK column to show what these distributions are doing for you. I would not expect that you actually build from the source unless you have some very specific needs (and remember, if you do that, all changes you make need to be contributed back to the project). As you can see there is generally not that much difference between the distributions, unless you need a specific platform that happens to be only available in one distribution. For production you should only run one of the LTS versions (currently 8 and 11, next one is 17) so unless you plan on going into production in a couple of years then it doesn't really matter if the latest release of Java is available. I would recommend that you select the Azul Zulu distribution as it is the most versatile in terms of available versions, release cycle and has excellent Docker support. Also if need be you can purchase support. The exception being that if you go on AWS then you might just as well take Corretto.