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
I had a similar issue and found the answer in another thread:
Symbolic link messed up on OSX while trying to change the Java version
I set JAVA_HOME as follows:
export JAVA_HOME=/Library/Java/Home
and it's working now.