✨适用情况
- 下载Oracle官方的 dmg 后 双击 pkg文件形式安装的Java环境
- Homebrew 或者 MacPorts 安装
如果通过 Homebrew 或者 MacPorts 安装,也请按照如下方法卸载。
✨Standard Edition Installation Guide
Java Platform, Standard Edition Installation Guide 中对卸载都有详细说明
JDK JRE分别都说明了卸载方式
卸载Java环境时要同时卸载JDK与JRE
官方文档中特别强调
Note:
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 that you perform an update of the OS.
各版本 Standard Edition Installation Guide 如下
-
Java8
-
Java9
-
Java10
-
Java11
✨卸载演示
根据上述提供的官方文档卸载Java8
Java8
- https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
- https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html
首先卸载JDK
查看当前JDK环境
cd /Library/Java/JavaVirtualMachines
ls
我们当前的JDK环境为 jdk1.8.0_281.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk
然后卸载JRE
To uninstall the JRE, you must have Administrator privileges and execute the remove commands either as root or by using the sudo(8) tool.
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane
与卸载前的设置界面对比可以注意到Java控制面板已经没有了。
✨参考及引用
https://*.com/questions/50056598/how-to-uninstall-jdk-on-mac-os
⭐转载请注明出处
本文作者:双份浓缩馥芮白
原文链接:https://www.cnblogs.com/Flat-White/p/15823443.html
版权所有,如需转载请注明出处。