Set default JDK on Mac OS X
Apple announced to remove Java Preferences app from Mac OS X http://support.apple.com/kb/HT5493. Let's try to fix it. Generally, java applications will use the JAVA_HOME environment variable to pick a JDK.
To set to JDK 6
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
To set JDK 7
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
To set JDK 8
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Created aliases for my zsh
alias setjdk16='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)'
alias setjdk17='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)'
alias setjdk18='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'
For exotic cases, like Netbeans follow instruction here https://blogs.oracle.com/bobby/entry/switching_jdks_on_mac
--
Cheers
Vik
Related protips:
Written by gAmUssA
Related protips
1 Response
Thank you for the article, it helped me a lot.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mac os x
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#