Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?)

share|improve this question
2  
In most IDE's you can set the version of Java you want to use for development, if you have several versions installed. In Eclipse this is done under Preferences -> Java -> Installed JREs –  tor Mar 14 '13 at 4:16
2  
Have you already tried the steps mentioned here?docs.oracle.com/javase/7/docs/webnotes/install/mac/… –  iDev Mar 14 '13 at 6:12
    
@ABC Ah you're right! JDK 7 is installed to /Library/Frameworks not /System/Library/Frameworks if you write up that answer I'll accept it. Thanks. –  Petriborg Mar 14 '13 at 11:08
    
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.