How to set the Java version on Mac OS X

Set the version of jdk to use

Thu, 10 Jan 2019

I have multiple versions of Java on my mac and its not intuitive to set a default JDK to use. This command will point to the version of java that you want to use.

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Run this command to check the current working version of java

echo $(/usr/libexec/java_home)
Buy Me A CoffeeDigitalOcean Referral Badge
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.