How To Uninstall Java From Mac
How To Uninstall Java From Mac
April 19, 2020

Java is among the popular programming languages used for Desktop and Web application development. We might be required to either uninstall it or completely remove it from the Mac system to install the higher version. This tutorial provides the steps required to uninstall Java from Mac systems. It provides all the steps required to remove Java 8 on Mac systems including macOS Sierra, High Sierra, Mojave, and Catalina.

Notes: The steps provided in this tutorial should be the same to uninstall Java 8, Java 9, Java 10, Java 11, Java 12, Java 13, and Java 14 from macOS Sierra, High Sierra, Mojave, and Catalina. We have to manually remove the Java files from the Mac system to uninstall it since there is no uninstaller that automatically removes Java. Also, we need admin login to uninstall Java.

Check Java Version

Open the Finder application and open the Applications -> Utilities folder. Now double click the Terminal to launch it. Also, check the existing Java version as shown in Fig 1.

# Java Version Check
java -version

# Java 8 on my system
java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

Java 8 - Mac - Check Version

Fig 1

It might be possible that multiple versions of Java are installed on the same system. We can use the below-mentioned command to list all the versions of Java installed on the system.

# List Java version
ls /Library/Java/JavaVirtualMachines

# Java Versions
jdk1.8.0_251.jdk

It listed only JDK 8 since I have only one version on my system as shown in Fig 2.

Java - Mac - Check Versions

Fig 2

Uninstall Java - All

In the previous step, we have checked the versions of Java installed on the system. We can completely remove Java from the Mac system by uninstalling all the versions using the commands as shown below.

# Remove Applet Plugin
sudo rm -rf "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"

# Remove JCP
sudo rm -rf "/Library/PreferencePanes/JavaControlPanel.prefPane"

# Remove Java Files
sudo rm -rf "/Library/Application Support/Oracle/Java"
# OR
sudo rm -rf "/Library/Application Support/Java"

# Remove JDKs
sudo rm -rf "/Library/Java/JavaVirtualMachines"

The above-mentioned commands will uninstall all the Java versions installed on the system as shown in Fig 3.

Java - Mac - Uninstall

Fig 3

Now we can have a clean install of the appropriate version of Java on the Mac system. You may be interested in How To Install Java 8 On Mac.

Uninstall Java - Single

We can also uninstall a specific version of Java instead of removing all. It can be done by using the commands as shown below.

# List Java version
ls /Library/Java/JavaVirtualMachines

# Java Versions
jdk1.8.0_251.jdk

# Remove JDK 8
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk

Summary

This tutorial provided the steps required to view the Java versions installed on the Mac system and also provided the steps to either remove all the Java versions or a specific version of Java.

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS