How to *Completely* Uninstall Java from your Mac

I found instructions on Oracle's Java web site. However, they weren't complete. This post lists all the steps needed to completely remove Java from your Mac.

This link gives details on how to uninstall Java. The first bit is definitely necessary (snippet added below so you don’t have to visit another link):

Uninstall Oracle Java using the Terminal

Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo.

Remove one directory and one file (a symlink), as follows:

  1. Click on the Finder icon located in your dock
  2. Click on the Utilities folder
  3. Double-click on the Terminal icon
  4. In the Terminal window Copy and Paste the command below:
    sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
    sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane

Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.

While these steps definitely help, they don’t completely uninstall Java, especially if you have multiple versions on your system that you didn’t know about (this was my predicament).

Going back to Terminal, type the following:

cd /Library/Java/JavaVirtualMachines

The first line is a “change directory” command. The next line is a “list” files and directories command. What you might see is this:

cd /Library/Java/JavaVirtualMachines

1.6.0.jdk is the old version that’s still sitting on my computer after going through Java/Oracle’s instructions for removing Java. This last bit is fairly simple. In the Terminal, type this:

sudo rm -rf 1.6.0.jdk

If you don’t have the same version I do, you can type sudo rm -rf, then type a space and the first number of the version you see sitting in that directory. Then, hit the tab button immediately after, and the full name of the item should automatically populate. Then, hit Enter. If you haven’t entered your admin password in a while, you may be asked to enter it again here.

I recommend a restart after you’ve uninstalled.

If you have any questions about this process, feel free to post your comments below. Thanks!