Java is known for its security flaws — to this day, over a hundred vulnerabilities have been identified. This is especially alarming because the programming language is installed on as much as 65% of all computers in the US alone. Most of the time it’s because users neglect updating it to the latest versions, which, as with any other software, creates a major security risk.
The good news is unless you’re running an application that requires Java (such as Citrix or Blackboard) or visiting websites that use the language (e.g. The Wall Street Journal sometimes employs Java for dynamic charts), you don’t really need it on your computer.
In this article, we will tell you how to uninstall Java on a Mac:
Uninstall Java using Terminal
The most straightforward way to remove Java from a Mac is by using the Terminal command line. Before you do anything, make sure you have administrator privileges on your computer, which enables you to make changes to the system. Once you know you’re an admin, use the following instructions to delete any version of Java.
How to remove Java from a Mac with Terminal step-by-step:
1. Go to Finder and open Terminal by following Applications → Utilities → Terminal
2. Copy and paste the following commands in the Terminal line:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
3. Hit Enter
4. Enter your user account password and press Enter again
Restore Apple Java after uninstalling
You can reinstall Java 7 and later versions on a Mac by using the link on the official Java website. The recommended version is Java 8 — it’s important to keep the application updated to minimize security threats. Make sure that you have:
- Admin privileges
- A fast 64-bit browser such as Safari
- Intel core
- macOS 10.7.3 and above
What to do after downloading the installer:
1. Make sure you downloaded the correct file. For the latest version of Java 8, it’s jre-8u65-macosx-x64.pkg
2. Double-click on the file to open it
3. Double click on the icon to launch the Wizard
4. Click past the windows until the installation is launched
5. Wait until the process is complete and move the Install Wizard to Trash
Unfortunately, there are still no certified versions of Java and JDK for macOS Catalina. This is due to stricter security checks by Gatekeeper. You can modify your security preferences to install non-notarized software such as Java and JDK, but beware of the risks that it takes.
Uninstall JDK
There can be multiple Java development kits on your Mac, or, more often, none at all. You can uninstall JDK via Terminal with just a few command prompts.
JDK uninstallation process:
- First, check if there’s a JDK in your directory. Copy and paste cd /Library/Java/JavaVirtualMachines and press Enter to open it
- Type in ls and press Enter to see the contents of the directory
- If you see a jdk file, use the rm prompt to delete it. Type in sudo rm -rf jdk1 and press the Tab key to complete the command
- Press Enter to erase the file
Make sure Java is gone
You can check that JDK is fully erased from your computer by typing in java in the Terminal command line and pressing Enter. The message “No Java runtime present, requesting install” indicates success.
Check that you’re deleted Java on a Mac in System Preferences. If the Java icon is gone from the bottom pane, you have uninstalled the software.
FAQ
How do I download Java Kit for Mac?
You can find and download a Java development kit for macOS on JDK’s official website. However, bear in mind that you must use a 64-bit browser.
Should I uninstall Java?
You should always keep all of your software and applications up to date and uninstall the items that you don’t use. If you don’t utilize apps and websites that run on Java, we recommend you uninstall it.
How do I know if Java is installed on my Mac?
To check if your Mac has Java, go to the Apple menu in the top left corner of the screen and open System Preferences. If you don’t see a Java icon in the bottom pane, Java 7 or later is not installed on your computer.
Alternatively, you can type in java -version in the Terminal command line to see the information about the version of Java currently installed on your Mac. If there is no Java, you will get a “No Java runtime present” message.
Is Java safe for Mac?
Java does impose some security threats for users of all operating systems. However, the risk diminishes if you keep the software up to date. If you’ve decided to download Java on your Mac, make sure to only use the official website.
Read more: