To uninstall AdoptOpenJDK installed via Homebrew,
brew uninstall adoptopenjdk8
To uninstall OpenJDK installed via Homebrew,
brew uninstall openjdk8
Answer from user5780831 on Stack OverflowTo 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:
(brew list | grep -iE 'java|jdk|temurin'); do brew uninstall $pkg; done
macos - Removing Java 8 JDK from Mac - Stack Overflow
uninstallation - Uninstall Java version 11 mac - Stack Overflow
How to uninstall Java
Uninstall java cask failing
Videos
I was able to unistall jdk 8 in mavericks successfully doing the following steps:
Run this command to just remove the JDK
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
Run these commands if you want to remove plugins
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist
You just need to use these commands
sudo rm -rf /Library/Java/*
sudo rm -rf /Library/PreferencePanes/Java*
sudo rm -rf /Library/Internet\ Plug-Ins/Java*
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.