I have jdk 1.6 and 1.7 installed.
I have updated my JAVA_HOME variable to
C:\\Program Files\\Java\\jdk1.6.0_24;C:\\Program Files\\Java\\jdk1.7.0
The simplest solution would be to use the java_home tool.
/usr/libexec/java_home -v 1.7.0_51 --exec javac -version