How to install openjdk 10 Mac using brew (adoptopenjdk)

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).[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. OpenJDK is the official reference implementation of Java SE since version 7.


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 

1 Comment Posted

  1. Very helpful.
    A few issues on my MACOS install of OpenJDK11 ..

    1> sudo permissions needed first for brew on most /usr/local folders

    sudo chown -R $(whoami) /usr/local/share

    2> when done with JDK11, JDK8 is still the default JDK

    location: Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk
    install-time: 1599488420
    ? adoptopenjdk11 was successfully installed!

    I had to run this to set the default JDK to JDK 11
    export JAVA_HOME=`/usr/libexec/java_home -v 11`

Leave a Reply

Your email address will not be published.


The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99