Switching to AdoptOpenJDK

JD Liu
Solace PubSub+
Published in
2 min readJan 3, 2019

Oracle is switching to a subscription-based JDK as of January 2019. If we stick with Oracle JDK, we would need to buy a subscription, unless we are willing to keep up with Java releases ourselves. For us, the main issues are the security patches and critical bug fixes which we could not otherwise get for free without a subscription contract.

As it turns out, keeping up with Java release is a big headache and not always practical. However, paying for subscription is also not cost efficient for what we get — performance and the extra features provided by Oracle JDK are not that relevant to us.

The solution is to switch to AdoptOpenJDK. AdoptOpenJDK provides Java 8 LTS (till Sept 2022) and Java 11 LTS (till Sept 2022).

Switching to AdoptOpenJDK is a relatively easy task. Besides switching the docker image from AplineLinux OpenJDK to AdoptOpenJDK and switching Jenkins to use AdoptOpenJDK, the most involved step is to switch our engineer’s dev environments (Mac) to use AdoptOpenJDK.

Here are the step by step guide for replacing Oracle Java with Adopt Open JDK on Mac

  1. Uninstall Oracle JRE by running this command in a terminal
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.pluginsudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane

2. Uninstall Oracle JDK

cd /Library/Java/JavaVirtualMachinessudo rm -rf jdk*cd ~

3. Check that java is removed by typing

java

It should give something like “No Java runtime present, requesting install”

4. Run the Following Commands to install AdoptOpenJDK (please make sure you are not in /Library/Java/JavaVirtualMachines directory)

brew tap AdoptOpenJDK/homebrew-openjdkbrew cask install adoptopenjdk8

5. Confirm that it worked

java -versionopenjdk version "1.8.0_192"OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)

6. (future) To update AdoptOpenJDK, run the following command

brew cask upgrade adoptopenjdk8

7. If you need to update your favourite IDE, Adopt OpenJDK’s Java Home will be in this directory

/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

--

--

JD Liu
Solace PubSub+

Always a Software Designer, currently working at Solace.