如何从 Mac OS 卸载 JAVA JDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51780530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:14:54  来源:igfitidea点击:

How to uninstall JAVA JDK from mac OS

javamacos

提问by

I Installed JAVA version 10. But I can't run react native with android because android doesn't support java version 10.now I need to revoke my java version to 8 How can I do it.

我安装了 JAVA 版本 10。但是我无法使用 android 运行 react native,因为 android 不支持 java 版本 10。现在我需要将我的 java 版本撤销到 8 我该怎么做。

采纳答案by Akila Devinda

You can get official oracle instruction to remove java from macOS here

您可以在此处获取从 macOS 中删除 java 的官方 oracle 说明

In your macOS terminal type this one by one

在您的 macOS 终端中,一一输入

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


After that you can navigate to specific version of java that you intend to delete by using the following command:


之后,您可以使用以下命令导航到要删除的特定 Java 版本:

cd /Library/Java/JavaVirtualMachines

Then type lsin your terminal to list down all the Java Virtual Machine Folders.
Finally add the version number you want to delete like this

然后ls在您的终端中输入以列出所有 Java 虚拟机文件夹。
最后像这样添加要删除的版本号

sudo rm -rf jdk-10.0.1.jdk

sudo rm -rf jdk-10.0.1.jdk

Instead of jdk-10.0.1.jdkyou can give any version number which are listed down in your above mentioned folder.

您可以提供上面提到的文件夹中列出的任何版本号,而不是jdk-10.0.1.jdk

回答by

Update:

更新:

  1. First Remove the java runtime

    sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane

    (Now you can close and reopen the System Preferences window to see that the icon is gone)

  2. Uninstall java JDK

    In the terminal run this First, go to java directory

    cd /Library/Java/JavaVirtualMachines

    And then use “ls” at the prompt to see if there is anything in there. In my case, there was. So then you'll type in the following:

    sudo rm -rf jdk

    Then press tab to autocomplete java version.

  3. To check java is gone

    java

    it should give No Java runtime present, requesting install

  1. 首先删除java运行时

    sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane

    (现在您可以关闭并重新打开“系统偏好设置”窗口以查看图标消失了)

  2. 卸载 Java JDK

    在终端运行这个首先,转到java目录

    cd /Library/Java/JavaVirtualMachines

    然后在提示符处使用“ls”查看是否有任何内容。就我而言,有。那么你将输入以下内容:

    须藤rm -rf jdk

    然后按 Tab 键自动完成 java 版本。

  3. 检查java消失了

    爪哇

    它应该给 No Java runtime present, requesting install