From the official Oracle manual.

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:

/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk

For example, to uninstall 8u6:

%rm -rf jdk1.8.0_06.jdk

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.

To remove system files you need to add sudo before rm -rf command.

Answer from Danila Zharenkov on Stack Overflow
🌐
Reddit
reddit.com › r/macos › how to uninstall java
r/MacOS on Reddit: How to uninstall Java
August 6, 2022 -

I installed several versions of the JDK, both official and open source. But I no longer need them. How exactly do you "uninstall" Java on macOS?

The best I can figure is just to go into HD/Library/Java and just delete everything there. Slightly new to macOS so wondering if this is right. The installers themselves don't give any means of uninstalling.

🌐
Oracle
java.com › mac_uninstall_faq
How do I uninstall Java on my Mac?
Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo tool.
Discussions

macos - How to uninstall java from mac completely? JRE and JDK - Stack Overflow
I did navigate to /Library/Java/JavaVirtualMachines and removed the jdk, and there is nothing in that folder anymore. But my terminal shows I have some version of java, so I am a little confused, I... More on stackoverflow.com
🌐 stackoverflow.com
macos - Removing Java 8 JDK from Mac - Stack Overflow
So I installed the beta of JDK 8 a while ago to look at some of the examples. I thought for sure by now, it's easy to change between versions. Doing some Play development with IntelliJ. For some ... More on stackoverflow.com
🌐 stackoverflow.com
How do I uninstall the Java JDK in macOS? - Stack Overflow
I installed Java version 10, but I can't run React Native with Android because Android doesn't support Java version 10. Instead, I need to uninstall Java version 10 so that I can install a compatible More on stackoverflow.com
🌐 stackoverflow.com
Uninstalled Java but it still shows up in… - Apple Community
I had downloaded both the JDK 20.0.2 and the Java 8 Update 381 on my MacBook Pro M1 2020 version macOS Monterey 12.2.1 to run a program that required Java. However, I couldn't run it no matter what I tried as it kept saying "Unable to load Java Runtime Environment" - I even asked a question about it on the Community just a few hours ago. Then, I had the genius idea to uninstall ... More on discussions.apple.com
🌐 discussions.apple.com
August 1, 2023
🌐
CodeJava
codejava.net › java-se › uninstall-jdk-on-macos
How to Completely Uninstall JDK on macOS
April 29, 2022 - Then type the following command to remove a JDK installation completely from macOS: sudo rm -rf jdk-versionThis command will be executed under root privilege (password required) - the specified JDK directory will be deleted recursively and forcefully.If you uninstall JDK 1.8, you also need ...
Top answer
1 of 2
134

You can get official oracle instruction to remove java from macOS here

In your macOS terminal type this one by one

Copysudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane 
sudo rm -fr ~/Library/Application\ Support/Oracle/Java


After that you can navigate to specific version of java that you intend to delete by using the following command:

Copycd /Library/Java/JavaVirtualMachines

Then type ls in your terminal to list down all the Java Virtual Machine Folders.
Finally add the version number you want to delete like this

sudo rm -rf jdk-10.0.1.jdk

Instead of jdk-10.0.1.jdk you can give any version number which are listed down in your above mentioned folder.

2 of 2
9

Update:

  1. First remove the java runtime

    Copy$ sudo mv /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin ~/
    $ sudo mv /Library/PreferencePanes/JavaControlPanel.prefpane ~/
    

    Now you can close and reopen the System Preferences window to see that the icon is gone.

  2. Next, uninstall the Java JDK. Open a terminal and change to the Java directory:

    Copy$ cd /Library/Java/JavaVirtualMachines
    

    You can use ls at the prompt to see what is in the directory and copy the jdk's path name with version number that you wish to delete.

    Copy$ ls --directory *jdk*
    examplejdk-7.jdk
    

    Copy the exact name of the path you want to remove -- for this example it's examplejdk-7.jdk. Next, use that path name inside of single quotes ('examplejdk-7.jdk') to move it to your desktop. Instead of deleting the directory, this moves it to your desktop so you can restore it later in case there's an issue!

    Copy$ sudo mv 'examplejdk-7.jdk' ~/
    
  3. To confirm that it has been removed, run this command:

    Copy$ java
    

    This should output an error message:

    No Java runtime present, requesting install
    
Find elsewhere
🌐
wikiHow
wikihow.tech › computers and electronics › operating systems › mac › how to remove java: macos uninstallation guide and tips
How to Remove Java: MacOS Uninstallation Guide and Tips
January 17, 2026 - The best way to uninstall Java on macOS is via the Terminal, using the remove command. If you still have the installer for your version of Java, you can use it to uninstall Java. Use the Terminal to remove the JDK (if you have it) and the Java ...
🌐
Nektony
nektony.com › home › blog › how to uninstall java on a mac completely
How to uninstall Java on Mac - Detailed steps
July 14, 2025 - In our experience, using Terminal commands or a dedicated Java uninstall tool like App Cleaner & Uninstaller can help force a complete and safe removal. ... It turned out that removing Java from a Mac can be more complicated than expected, especially when dealing with multiple JDK versions, hidden files, and leftover components.
🌐
CleanMyMac
cleanmymac.com › blog › uninstall-java-jdk-mac
How to uninstall JDK and Java on Mac
February 27, 2025 - So, If you're not actively using any Java-based applications, it's best to remove them to keep your Mac optimized and secure. Ok, so we've covered all the basics; let's get to the main event: how to remove Java properly. If you've been searching like mad for an app icon, unlike most installed applications and software, Java doesn't appear in your Applications folder. While you can delete Java manually, the process involves searching for system files and ensuring all traces are removed. Below, we'll show you how to uninstall Java on Mac using a built-in removal method, a manual cleanup, and a much easier alternative method.
🌐
javaspring
javaspring.net › blog › macos-uninstall-java-jdk
Uninstalling Java JDK on macOS: A Comprehensive Guide — javaspring.net
Uninstalling unused versions can reduce the security risk. Cleanup: Removing old or unused JDK versions can help keep your system clean and organized. Administrative Privileges: You need to have administrative privileges on your macOS system to uninstall Java JDK.
🌐
Mac Install Guide
mac.install.guide › java › uninstall
Uninstall Java on Mac · Mac Install Guide · 2026
Uninstall Java on Mac. macOS uninstall for JDKs, files, caches, and shell configuration. Clean up Homebrew, delete Oracle files, and verify Java removal.
🌐
Oracle
java.com › en › uninstall › uninstall_instructions.html
Uninstall instructions for Java
The Add/Remove control panel displays a list of software on your system, including any Java software products that are on your computer. Select any that you want to uninstall by clicking on it, and then click the Remove button.
🌐
Oracle
java.com › en › download › uninstalltool.jsp
Java Uninstall Tool for macOS
» Troubleshoot Java » Instructions for Uninstalling Java » Request Uninstall Help » Other help · If you are experiencing issues while uninstalling Java, please see the Java uninstall instructions. If you are still having trouble uninstalling out-of-date versions of Java, you can request ...
🌐
MacKeeper
mackeeper.com › blog › mac tutorials › how to uninstall java on a mac
How to Uninstall Java on a Mac
September 24, 2025 - You can modify your security preferences to install non-notarized software such as Java and JDK, but beware of the risks that it takes. 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.
🌐
javathinking
javathinking.com › blog › how-to-uninstall-java-from-mac-completely-jre-and-jdk
How to Uninstall Java Completely from Mac (JRE & JDK): Fix OpenJDK Still Showing in Terminal — javathinking.com
Note: macOS may restore this symlink automatically if you reinstall Java later. After uninstalling, confirm Java is fully removed with these checks: ... # JDK directory should be empty or not exist ls /Library/Java/JavaVirtualMachines/ # JRE plugin should be removed ls /Library/Internet\ Plug-Ins/ | grep Java
🌐
Apple Community
discussions.apple.com › thread › 255037283
Uninstalled Java but it still shows up in… - Apple Community
August 1, 2023 - I had downloaded both the JDK 20.0.2 and the Java 8 Update 381 on my MacBook Pro M1 2020 version macOS Monterey 12.2.1 to run a program that required Java. However, I couldn't run it no matter what I tried as it kept saying "Unable to load Java Runtime Environment" - I even asked a question about it on the Community just a few hours ago. Then, I had the genius idea to uninstall ...
🌐
MacPaw
macpaw.com › how to › optimization › apps
How to uninstall OpenJDK: Mac user guide
January 10, 2025 - If you have previously installed OpenJDK on your MacBook and no longer need it, you should remove it. We’ll show you how to uninstall OpenJDK on Mac.