View Source


In this article we show you how to set $JAVA_HOME environment variable on *Mac OSX 10.5 or later*.

Set the $JAVA_HOME variable to */usr/libexec/java_home*, just export $JAVA_HOME in file ~/. bash_profile or ~/.profile as shown below

{noformat}
$ vim .bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)

$ source .bash_profile

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
{noformat}

----

{panel}
(i) Orginal Article from [Mkyong.com | http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/]
{panel}