Apple

Apple's OS Lion has a pretty neat trick for handling the JAVA_HOME variable
Chill:bin rus$ /usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
which is super awesome as you can simply do
Chill:bin rus$...