Uninstall Java (JDK) on Mac

Follow the prompts on the official website , in the "Terminal" window, copy and paste commands:

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java

But you will find that after executing the above three commands, even if you execute it several times, you can still view the version information (java -version) and the installation directory (/usr/libexec/java_home -V):

From the directory printed above, you can see that the current version is: /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk. Of course, you can also use the following command to print out the current version:

ls /Library/Java/JavaVirtualMachines/

Then execute to delete the current version:

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk

At this time, you can’t see the relevant information when you check the version and installation directory, but the /Library/Java-related directory is still there. In fact, you can directly execute "sudo rm -rf /Library/Java" without manually deleting it, but you don’t need to delete it manually. I wrote "/Java" without shaking hands, and waited for the system to have a problem!

Original link: https://www.xubingtao.cn/?p=3716

Follow my public account to share all kinds of useful information for you every day.

For more information, please visit my other side:

Guess you like

Origin blog.csdn.net/xubingtao/article/details/115318884