0 votes
1 view
in Java by (3.4k points)

How can you change the default version of Java on a mac?

1 Answer

0 votes
by (33.8k points)

Follow these steps to change the default version of Java on mac:

  • Open the Terminal

  • Confirm that you have JDK by typing “which java”. It should show something like /usr/bin/java.

  • Check you have the needed version of Java, by typing “java -version”.

    •         JAVA_HOME is typically the full path of the directory that includes a sub-directory named bin which in turn holds the java.

    •         For Mac OSX – it's /Library/Java/Home

  • Set JAVA_HOME doing this command in Terminal: export JAVA_HOME=/Library/Java/Home

  • echo $JAVA_HOME on Terminal to validate the path

  •  You should now be able to run your application