How to Install Java 7 on Mountain Lion
Published: 20 Dec 2012
To start, download and install the latest release of Java 7 from Oracle.com here.
After the install is complete you should have it here:
/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk
Since Apple has done away with the Java Preferences application which allowed you to easily switch between versions of Java, this is now a manual process.
Assuming you’re using the default Java version you first move it out of the way:
sudo mv /System/Library/Java/JavaVirtualMachines/1.6.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk-orig
Now create a symlink from the old 1.6 jdk path to the new 1.7 path:
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
and verify with java -version
:
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)