Java教程

【教程】macOS完全卸载Java开发环境

本文主要是介绍【教程】macOS完全卸载Java开发环境,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

✨适用情况

  • 下载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

    • 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
  • Java9

    • https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm#JSJIG-GUID-F9183C70-2E96-40F4-9104-F3814A5A331F
    • https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm#JSJIG-GUID-577CEA7C-E51C-416D-B9C6-B1469F45AC78
  • Java10

    • https://docs.oracle.com/javase/10/install/installation-jdk-and-jre-macos.htm#JSJIG-GUID-F9183C70-2E96-40F4-9104-F3814A5A331F
    • https://docs.oracle.com/javase/10/install/installation-jdk-and-jre-macos.htm#JSJIG-GUID-577CEA7C-E51C-416D-B9C6-B1469F45AC78
  • Java11

    • https://docs.oracle.com/en/java/javase/11/install/installation-jdk-macos.html#GUID-F9183C70-2E96-40F4-9104-F3814A5A331F

✨卸载演示

根据上述提供的官方文档卸载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://stackoverflow.com/questions/50056598/how-to-uninstall-jdk-on-mac-os


⭐转载请注明出处

本文作者:双份浓缩馥芮白

原文链接:https://www.cnblogs.com/Flat-White/p/15823443.html

版权所有,如需转载请注明出处。

这篇关于【教程】macOS完全卸载Java开发环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!