Steps I performed were from here : https://www.java.com/en/download/help/mac_uninstall_java.html
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/JavaThen 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"then remove the jdk folder and it's content:
sudo rm -r -f /Library/Java/JavaVirtualMachines/jdk<"your_version">.jdkthen 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
Answer from user18091415 on Stack OverflowHow can I remove java 17 and java 20 from Arch?
how to delete java completely from windows - Stack Overflow
How to uninstall Java
macos - How to uninstall java from mac completely? JRE and JDK - Stack Overflow
Videos
Steps I performed were from here : https://www.java.com/en/download/help/mac_uninstall_java.html
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/JavaThen 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"then remove the jdk folder and it's content:
sudo rm -r -f /Library/Java/JavaVirtualMachines/jdk<"your_version">.jdkthen 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
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
First time when executed these 2 commands it said I deleted something but I didn't?
https://imgur.com/8W3868m
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.
Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove sudo apt-get -y autoremovePurge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purgeRemove Java config and cache directory:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rfRemove manually installed JVMs:
sudo rm -rf /usr/lib/jvm/*Remove Java entries, if there is still any, from the alternatives:
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; doneSearch for possible remaining Java directories:
sudo updatedb sudo locate -b '\pack200'If the command above produces any output like
/path/to/jre1.6.0_34/bin/pack200remove the directory that is parent of bin, like this:sudo rm -rf /path/to/jre1.6.0_34.
To completely remove OpenJDK on Ubuntu 11.10 (this may or may not be sufficient on other versions of Ubuntu), run:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
If you want instructions for removing the proprietary Oracle ("Sun") version of Java, then you'll have to specify how you installed it. (If you edit your question to indicate this and leave a comment to this answer, I'll try to add information about how to remove that too.)
To uninstall AdoptOpenJDK installed via Homebrew,
brew uninstall adoptopenjdk8
To uninstall OpenJDK installed via Homebrew,
brew uninstall openjdk8
The /usr/bin/java and other related tools are macOS shims that run a specific version of Java, as defined by the JAVA_HOME variable.
This variable is usually set in your ~/.bashrc file:
export JAVA_HOME=$(/usr/libexec/java_home -v1.8)`
You can check the current value:
$ echo $JAVA_HOME
/usr/local/Cellar/openjdk@8/1.8.0-392/libexec/openjdk.jdk/Contents/Home
You may have multiple versions of Java installed, to list them all:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
21.0.1 (x86_64) "Homebrew" - "OpenJDK 21.0.1" /usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
17.0.9 (x86_64) "Homebrew" - "OpenJDK 17.0.9" /usr/local/Cellar/openjdk@17/17.0.9/libexec/openjdk.jdk/Contents/Home
1.8.0_392 (x86_64) "Homebrew" - "OpenJDK 8" /usr/local/Cellar/openjdk@8/1.8.0-392/libexec/openjdk.jdk/Contents/Home
/usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
In my case, you can see there are three versions of OpenJDK installed via homebrew. I can look them up in the list of installed packages:
$ brew list | grep -iE 'java|jdk|temurin'
openjdk
openjdk@17
openjdk@8
If I wanted to remove all of them, I could do brew uninstall them one by one, or:
$ for pkg in $(brew list | grep -iE 'java|jdk|temurin'); do brew uninstall $pkg; done