Mac And Java 9 – How to set JDK 9 as default


This page will show step by step to set JDK 9 as default JVM on MAC.


  1. Java 9 should have installed. If not follow the instruction given on oracle website.


  1. Get installed Java: Open terminal and execute-

    /usr/libexec/java_home -V   [<——-  side note : this is capital v]

    Each row first column is the java version. Copy it against java 9 version.

  2. Set default Java: execute-

    /usr/libexec/java_home -v {Put_Copied_Version} –exec javac -version[<——-  side note : here is small v]

  3. Set environment variable: Update bash profile or terminal as follows

     export JAVA_HOME=`/usr/libexec/java_home -v {Put_Copied_Version}`



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s