How to set JAVA_HOME in Mac permanently?
You can use /usr/libexec/java_home -v <version you want> to get the path you need for JAVA_HOME. For instance, to get the path to the 1.7 JDK you can run /usr/libexec/java_home -v 1.7 and it will return the path to the JDK. In your .profile or .bash_profile just add export JAVA_HOME=`/usr/libexec/java_home -v <version>` and you should … Read more