I recently upgraded to Java7 on my Macbook Pro. I downloaded the JDK (not the JRE).
» javac version
javac 1.7.0_17
» echo $JAVA_HOME
/Library/Java/Java
The correct way to set JAVA_HOME on MacOS X is to use:
[user@ip ~]$ export JAVA_HOME=$(/usr/libexec/java_home -v1.7)
[user@ip ~]$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home
Your java installation is broken if, after doing this, $JAVA_HOME/lib does not contain a tools.jar.
Tip: I have these two aliases specified in my ~/.bash_profile:
alias java6="export JAVA_HOME=$(/usr/libexec/java_home -v1.6)"
alias java7="export JAVA_HOME=$(/usr/libexec/java_home -v1.7)"
Placing jars in /Library/Java/Extensions is equivalent to putting them in the global classpath and is rarely a good idea.