In this tutorial, I will show you how to install OpenJDK 10 Mac (adoptopenjdk). You have to pay for Oracle JDK so it’s better to use OpenJDK.
OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GNU General Public License (GNU GPL) version 2 with a linking exception. Were it not for the GPL linking exception, components that linked to the Java class library would be subject to the terms of the GPL license. OpenJDK is the official reference implementation of Java SE since version 7.
- brew should be installed (https://brew.sh/)
Read Also: How to install OpenJDK 8 on Ubuntu 18.04
Read Also: How to install OpenJDK 8 on Debian
1. Brew tap
First of all, we need to tap a brew repo. Just execute the following command:
# brew tap AdoptOpenJDK/openjdk
The above will add more repositories to brew.
2. Install OpenJDK 10 Mac
After adding tap, let’s install OpenJDK using brew.
# brew cask install adoptopenjdk10
So, now we have installed OpenJDK 8, we can check installation with the following command.
3. Check JDK Version
Now we can check the JDK version.
# java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment AdoptOpenJDK (build 10.0.2+13)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 10.0.2+13, mixed mode)
Now Java has installed properly.
4. Java Location
Now let’s check the java path.
# which java
Please let me know how you liked the tutorial.
Read Also: How to install OpenJDK 11 on Mac