How do I uninstall Java6 from Mac OS X

30

19

With the end of public updates for Java 1.6 in February 2012, and the long list of security updates on the later 1.7, I am inclined to remove Java 1.6 and the JDK permanently from my Mac, if only I knew how to accomplish this in a clean way.

Oracle Java EOL announcement

bbaassssiiee

Posted 2013-03-12T10:12:17.610

Reputation: 1 225

Answers

28

In Mac OS X 10.7 the JDK provided by Apple (Java 6) is installed in /System/Library/Java/JavaVirtualMachines/ so just delete it from there

The JDK provided by Oracle (Java 7) is installed in /Library/Java/JavaVirtualMachines/

Alexis

Posted 2013-03-12T10:12:17.610

Reputation: 396

3I just want to comment that if you install java 6 from Apple's Java installer (i.e. you do not have java pre-installed on Mac OS, as is common now), the java 6 will also be installed to /Library/Java/JavaVirtualMachines/, not the /System/Library/ one. – taper – 2017-11-25T17:26:39.593

Oracle installs them next to each other in this directory: /Library/Java/JavaVirtualMachines/

1.7.0.jdk jdk1.7.0_06.jdk jdk1.7.0_07.jdk jdk1.7.0_09.jdk jdk1.7.0_11.jdk jdk1.7.0_13.jdk jdk1.7.0_15.jdk jdk1.7.0_17.jdk jdk1.7.0_21.jdk jdk1.7.0_25.jdk – bbaassssiiee – 2013-06-21T06:46:56.787

18

I had the same question until today.

From The macosx-port-dev Archives and How to properly uninstall Java 6 on OSX?:

I agree with the assessment below,

(Previous message)

I don’t know the answer to your question, but I can suggest that you might be causing yourself unneeded problems.

Security updates are important because of web sites that use Java maliciously. But you can’t use Java 6 on the web anyway. You can only run Java 7 for applets.

Java 6 is on your machine for legacy software that relies on it in standalone applications. The security issues aren’t going to impact these apps. The security issues are invariably sandbox violation tricks, and the standalone apps aren’t running Java sandboxed anyway.

however if you wish to rid your machine of Java SE 6, the correct procedure is:

Remove the "system" JVM installed and maintained by Software Update

% sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Remove any Java Developer Previews

% sudo rm -rf /Library/Java/JavaVirtualMachines/1.6.0*.jdk

Do NOT remove any content in the JavaVM.framework (Note.: It under /System/Library/Frameworks/JavaVM.framework )

Those items are required by Java 7, 8, 9+ as well as Java SE 6. No modern version of OS X has a Java JDK inside there anyway.

BMourelo

Posted 2013-03-12T10:12:17.610

Reputation: 181

6

Go to the Macintosh HD/Library/Java/JavaVirtualMachines/ directory and remove the file called "1.6.0.jdk."

Source

Here is the official oracle documentation on how to uninstall jdk from a mac

gmazlami

Posted 2013-03-12T10:12:17.610

Reputation: 159

6

Regarding the answer above that says:

Do NOT remove any content in the JavaVM.framework (Note.: It under /System/Library/Frameworks/JavaVM.framework )

It's worth noting that /System/Library/Frameworks/JavaVM.framework contains a Versions folder, and at least in my case, that Versions folder contained:

lrwxr-xr-x  10 1.4 -> CurrentJDK
lrwxr-xr-x  10 1.4.2 -> CurrentJDK
lrwxr-xr-x  10 1.5 -> CurrentJDK
lrwxr-xr-x  10 1.5.0 -> CurrentJDK
lrwxr-xr-x  10 1.6 -> CurrentJDK
lrwxr-xr-x  10 1.6.0 -> CurrentJDK
drwxr-xr-x 238 A
lrwxr-xr-x   1 Current -> A
lrwxr-xr-x  59 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

It doesn't seem useful to leave CurrentJDK pointing to a non-existent directory, so I ran this command in the /System/Library/Frameworks/JavaVM.framework/Versions folder:

sudo ln -sf /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents CurrentJDK

since that's where my new JDK is installed.

UPDATE: After removing Java 1.6 from my machine, the next time I ran PhpStorm, it told me it needed to download and install the Java SE 6 runtime. Afterward, the /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK link was reset to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents. So it seems that the 1.6 JDK (or at least the JRE portion of it) may keep coming back, depending on other apps you use.

jeffpar

Posted 2013-03-12T10:12:17.610

Reputation: 61

+1 when you try to brew install maven it will look at this dead symlink for CurrentJDK and fail. Linking to the newer version seems to work. – Skylar Saveland – 2014-08-11T20:29:03.710

1

I know this is old, but to get PHPStorm to work with newer versions of the JDK you need to modify its info.plist file. There is a JVMVersion key in there. Source: https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under

– ianbarker – 2014-09-02T13:10:44.053