Apple’s OS Lion has a pretty neat trick for handling the JAVA_HOME variable

Chill:bin rus$ /usr/libexec/java_home

which is super awesome as you can simply do

Chill:bin rus$ export JAVA_HOME=$(/usr/libexec/java_home)
Chill:bin rus$ echo $JAVA_HOME

to make sure you have the correct $JAVA_HOME set up, every time!

I’ve added this commend to my ~/.profile file so that whenever I open a new terminal, the $JAVA_HOME variable gets set correctly!

About rus

Arrogant, narcissistic and imperatively logical. I first started coding in the mid 80s on an Amstrad 6128, entering games found in the back of Amstrad Action.After watching Hackers and falling in love with Angelina Jolie I installed Slackware 2.0 on a P200 in 1997and spent the next 6-7 years studying computery things at various colleges and universities.Several years later I can now be found in an office premises by day sat in front of a Macbook, using a Windows VM to manage Linux servers, or in a field by night, fire dancing and holding pyrotechnics casually in my hands whilst they explode.