In this article, I will demonstrate how to install Java OpenJDK 14 on macOS Catalina in 2020.
If you are interested in installing OpenJDK 15 (which is the newest version as of this writing), please see this article: How to Install Java OpenJDK 15 on macOS Catalina
Download and Install OpenJDK 14
.tar.gz version of OpenJDK 14 from jdk.java.net/14/.
sudo mv openjdk-14.0.1_osx-x64_bin.tar.gz /Library/Java/JavaVirtualMachines/ cd /Library/Java/JavaVirtualMachines/ sudo tar -xzf openjdk-14.0.1_osx-x64_bin.tar.gz sudo rm openjdk-14.0.1_osx-x64_bin.tar.gz
Next, execute the following command to find out where JDK 14 is located:
$ /usr/libexec/java_home -v14 /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
and append the resulting path as an export into your
echo -n "\nexport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home" >> ~/.bash_profile
and make sure to apply the changes:
You should now be able to run java:
Depending on your security settings, the following warning needs to be accepted by clicking “Open”:
You should then see an output similar to the following:
openjdk version "14.0.1" 2020-04-14 OpenJDK Runtime Environment (build 14.0.1+7) OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Congratulations! You have installed OpenJDK 14.
One more thing:
I’m currently working on a cool side project named pingmy.tech – it allows you to monitor the execution of regular background tasks such as backups and notifies you when they are not executed on time. Please check it out and use the invitation code
BLOG20 to create an account for free: https://www.pingmy.tech