30

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

migrated from stackoverflow.com Mar 12 '13 at 13:54

This question came from our site for professional and enthusiast programmers.

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/

  • 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 Jun 21 '13 at 6:46
  • 3
    I 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 Nov 25 '17 at 17:26
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.

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

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.

  • +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 Aug 11 '14 at 20:29
  • 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: intellij-support.jetbrains.com/entries/… – ianbarker Sep 2 '14 at 13:10

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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