28

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

3 Answers 3

57

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
Sign up to request clarification or add additional context in comments.

1 Comment

Or just toss that folder to the trash in the Finder. You will likely be prompted for an admin password.
10
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

1 Comment

Close: 11.0.2 instead of 11.0.5
3

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

1 Comment

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.