Setting JAVA_HOME properly in Mavericks

export JAVA_HOME=$(/usr/libexec/java_home)

you can put it inside your ~/.profile.