Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.4k points)

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

1 Answer

0 votes
by (46k 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

Watch this Java Tutorial for Beginners:

Related questions

0 votes
1 answer
asked Jul 18, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
asked Jul 10, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer
0 votes
1 answer
asked Feb 6, 2021 in Java by dante07 (13.1k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...