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
If you find that the tools.jar
in /Library/Java/Extensions
is not from the right version of the JDK, then move it out of the way, so that there is no tools.jar there and there is a tools.jar in $JAVA_HOME/lib
(as set in the previous response).
eg
cd
sudo mv /Library/Java/Extensions/tools.jar tools.jar.safe