I'm running Lion (10.7), and need to use JDK 6 for development, but previously I had installed JDK 7 and I can't seem to get it uninstalled.

I ran the JDK 6 installer and seems to be installed in /System/Library/Java/JavaVirtualMachines/1.6.0.jdk, and JDK 7 seems to be installed in /System/Library/Frameworks/JavaVM.framework/Versions/A

Somewhere along the lines my Java Preferences seems to have been deleted (not by me).

I tried to delete everything (as described here) in /System/Library/Java/JavaVirtualMachines/ and /System/Library/Frameworks/JavaVM.framework/ and then do a fresh install of JDK 6, but both JDK 6 and 7 came back!

Worse /usr/bin/{java,javac} point to JDK 7.

Does anyone know how I can delete JDK 7? (And maybe get back my Java Preferences?)


1 Answer 1


Whatever development environment you're using, you can probably explicitly set it to use JDK 6, by setting $JAVA_HOME or changing preferences in an IDE like tor commented. But if that doesn't work for you, here's how to get JDK 6 back as the system default.

The Apple JDK 6 is installed on your machine; it's just being masked by the newer JDK 7. OS X's Java indirection layer will prefer newer versions. You can verify that it's there by doing /usr/libexec/java_home -v 1.6.

The Oracle JDKs live in /Library/Frameworks. You can remove them by just deleting them.

sudo rm -rf /Library/Java/JavaVirtualMachines/*.jdk
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane

You're out of luck on the Java Preferences. Apple removed it in an update. But when you eventually install a newer Oracle JDK again, you'll get a Java control panel with similar functionality.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .