In this tutorial, I will show you how to install OpenJDK 8 Mac. 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).[1] 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.
Read Also: How to install OpenJDK 13 on Mac
Read Also: How to install OpenJDK 12 on Mac with brew
Requirements
- brew should be installed (https://brew.sh/)
1. Brew tap
First of all, we need to tap a brew repo. Execute the following command:
$ brew tap AdoptOpenJDK/openjdk
The above will add more repositories to brew.
Read Also: How to uninstall/remove Java 10 from Mac
2. Install OpenJDK 8 Mac
After adding tap, let’s install OpenJDK using brew.
$ brew cask install adoptopenjdk8
Or on newer Mac OS Version
$ brew install --cask adoptopenjdk8
So, now we have installed Java 8, we can check installation with the following command.
3. Check JDK Version
Now we can check the JDK version.
# java -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.202-b08, mixed mode)
Now Java has installed properly.
4. Java Location
Now let’s check the java path.
# which java
/usr/bin/java
Please let me know how you liked the tutorial.
If you like this tutorial please consider buying me a coffee!
worked, thanks.
Hi, good tutorial thanks. It simply miss information about ‘java_home’. Have found it using cmd “/usr/libexec/java_home -V”
Hey Jean,
I’m glad it helped you.
Great article, works like a charm, thanks
Thanks, Rob for the lovely comments.
Quick and simple! Thank you
Thanks! Awesome nice simple tutorial. Works fine.
Excelente, muchas gracias por tu trabajo!!!
Thanks for the article, had to change step 2 to “brew install –crew adoptopenjdk8” to make it work on MAC Catalina.
For the latest version on Mac OS use the following command to install jdk
brew cask install adoptopenjdk8