I recently had an issue where an application I wanted to run on Mountain Lion needed Java 7 as the default JVM on the machine. The install for the app in question worked without errors, but the issue was highlighted when trying to run the app.
Here's how I fixed the problem.
Firstly, open Terminal and find out the current default Java version on your machine:
Download the Java 7 JDK from the Java SE site (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
Run the installer. Now, for me this still didnt ensure that the updated Java version was the current one used by the system.
In Terminal, navigate to the following location:
The CurrentJDK symlink in this directory was still pointing to an older Java version. To resolve this, remove the symlink and create a new one pointing to the new Java 7 JDK (you may need to use sudo to run these commands):
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ CurrentJDK
This fixed it for me. To confirm, check the Java version once again in Terminal:
You should now see java version "1.7.0_21" (or similar).