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.

Discussions

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
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
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
macos - How to remove OpenJDK and go back to regular JDK - Ask Different
I mistakenly installed openJDK and I want to uninstall it and revert back to using regular JDK I had before, how do I do this? I can’t find anywhere how I can I uninstall it and go back to JDK. More on apple.stackexchange.com
🌐 apple.stackexchange.com
June 14, 2021
🌐
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 ...
🌐
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
docs.oracle.com › en › java › javase › 18 › install › installation-jdk-macos.html
4 Installation of the JDK on macOS - Java
July 6, 2022 - This directory is part of the system software and any changes will be reset by Apple the next time that you perform an update of the OS. ... Remove the directory whose name matches the following format by executing the rm command as a root user or by using the sudo tool: /Library/Java/Java...
Find elsewhere
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
    
🌐
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.
🌐
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.
🌐
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.
🌐
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.
🌐
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 ...
🌐
Lehigh Computer Science
docs.cse.lehigh.edu › java › removing-java-mac
Removing Versions of Java on Mac OS - Lehigh Computer Science Docs
if [[ -d /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/ ]]; then \ sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/; fi · The above is just an example, substitute each of the folder names returned from the previous command. Mac OS will prompt for an administrative user password.
Top answer
1 of 3
5

Steps I performed were from here : https://www.java.com/en/download/help/mac_uninstall_java.html

  1. In the Terminal window Copy, Paste and run the commands below (one by one) :

    sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
    sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
    sudo rm -fr ~/Library/Application\ Support/Oracle/Java
    
    
  2. Then after successfully uninstalling Java, you may remove Java Deployment cache: In the Terminal window Copy and Paste the commands below:

    rm -r ~/"Library/Application Support/Oracle/Java"
    
  3. then remove the jdk folder and it's content:

    sudo rm -r -f /Library/Java/JavaVirtualMachines/jdk<"your_version">.jdk
    
  4. then perform the holy computer restart .

If you have more than 1 java version installed you may also find useful the info from this page: https://java.tutorials24x7.com/blog/how-to-switch-java-version-on-mac

2 of 3
1

You can try removing Java from your system with these commands

rm will remove the specified file or directory.

options -r If it's a directory, it will remove all its contents recursively, including subdirectories/files and their contents. -f Do this forcefully without asking for confirmation for each files and folders.

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk[version].jdk

Example:

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-17.jdk

Additional Files/Folders

sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf ~/Library/Application\ Support/Oracle/Java
🌐
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.
🌐
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.