Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uninstall JDK on Mac OS?

Folks - I am facing challenges while trying to uninstall JDK from my MAC (macOS High Sierra Version 10.13.4 - 17E199). I have two JDK instances installed and I want to uninstall both of them.

I am following the steps listed on this page: https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html

I am trying to run this command in the /Library/Java/JavaVirtualMachines directory which throws an error that I do not have the permission.

rm -rf jdk1.8.0_06.jdk 

I am the administrator of the machine and am not sure what more permission do I need. I have made attempts as the admistrator and as the root user with no success.

Please share your thoughts on this.

like image 904
Shivank Sharma Avatar asked Apr 27 '18 06:04

Shivank Sharma


People also ask

How do I completely remove JDK?

From the Windows Control Panel: Click Programs and Features. Select Java Card Development Kit from the list of programs. Click Uninstall and then Finish.

How do I remove multiple JDK from MAC?

JDK uninstallation process: Copy and paste cd /Library/Java/JavaVirtualMachines and press Enter to open it. Type in ls and press Enter to see the contents of the directory. If you see a jdk file, use the rm prompt to delete it. Type in sudo rm -rf jdk1 and press the Tab key to complete the command.

Where is JDK installed on Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation. This directory also contains copyright, README, and src.

How do I uninstall a specific version of Java on a Mac?

Locate and click on “Extensions” and go to “Preference Panes.” Find Java in the list, select it, and click “Remove.” Now, you've easily removed Java and its extensions from your Mac.


1 Answers

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.

like image 180
Danila Zharenkov Avatar answered Sep 28 '22 02:09

Danila Zharenkov