How to Completely Uninstall Java on Mac OS X

Java is prone to many holes and vulnerabilities. Unless you are using some application that absolutely needs Java, there is no reason for you to have it installed on your Mac. In fact, most websites and web services don’t require you to have Java. Simply put, unless you absolutely require Java, you should either disable Java on Mac or uninstall Java on Mac, just like Adobe Flash.

That being said, if you think you might need Java in future then you can always install it with just a few clicks. So, here is how to completely uninstall Java on Mac OS X.

Uninstall Java on Mac OS X

1. Uninstalling Java on Mac OS X is pretty easy but not straightforward if you don’t like to use the terminal. To start off, launch the terminal by searching for it in the Launchpad or Spotlight.


2. Once the terminal has been launched, copy the below command and execute it. You might be prompted for the admin password, just enter it to continue. Once the command has been executed, you won’t receive any confirmation message. So, don’t worry if you don’t see one.

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin


3. Next, copy and execute the below command. Just like before, you won’t receive any confirmation message.

sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane


4. Optionally, if you have Java JDK installed, you might want to uninstall it too. To verify if you have Java JDK installed, execute the below command.

cd /Library/Java/JavaVirtualMachines


5. The above action will take you to the JavaVirtualMachines folder. Here, use the command ls to see if it has any files. In my case, there are no files in the folder so I don’t have to do anything.


6. However, if there are any files in the folder, then use the below command to remove them. Don’t forget to replace “fileName” with the¬†actual file name.

sudo rm -rf fileName

That’s it, you’ve successfully removed Java on Mac OS X. To confirm, just enter below command press the Return button. If there is no Java, you will be presented with an error message like the below one.


Hopefully that helps and do comment below sharing your thoughts and experiences about using the above method to completely uninstall Java on Mac OS X.