How to uninstall a specific java version from a mac?
When I execute the following command:
/usr/libexec/java_home -V
I see the following.
Matching Java Virtual Machines (2):
11.0.2, x86_64: "OpenJDK 11.0.2" /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
1.8.0_202, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
I want to uninstall just Java 11.0.2 and keep the second one.
asked Mar 15, 2019 at 18:11
ashish1512
4932 gold badges5 silver badges11 bronze badges
3 Answers 3
Run this command and it will remove the JDK
sudo rm -rf /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk
answered Mar 15, 2019 at 18:15
moritzg
4,4145 gold badges41 silver badges63 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Basil Bourque
Or just toss that folder to the trash in the Finder. You will likely be prompted for an admin password.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk
Works for me
David Buck
3,88640 gold badges54 silver badges74 bronze badges
answered Apr 26, 2020 at 13:54
lookang lawrence wee
1011 silver badge2 bronze badges
1 Comment
Maurice Perry
Close: 11.0.2 instead of 11.0.5
Using Homebrew in the terminal did it easily for me. The following:
brew uninstall openjdk@11
// use java -version to verify that it's been uninstalled.
worked for me. The accepted answer did not work for me.
answered Apr 18, 2023 at 20:59
Shayne3000
7471 gold badge9 silver badges8 bronze badges
1 Comment
FRG96
This is the correct way if you have installed jdk via homebrew. If you have directly installed the .pkg then the accepted answer is the correct way
lang-java