如何在Mac OS上卸载JDK?

如何在Mac OS上卸载JDK?

问题描述:

朋友-尝试从MAC(macOS High Sierra版本10.13.4-17E199)卸载JDK时遇到了挑战.我已经安装了两个JDK实例,我想同时卸载它们.

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.

我正在按照此页面上列出的步骤进行操作: https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html

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

我试图在/Library/Java/JavaVirtualMachines目录中运行此命令,这会引发我没有权限的错误.

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

我是计算机的管理员,不确定我还需要什么权限.我曾作为管理员和root用户进行过尝试,但均未成功.

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.

请分享您对此的想法.

来自 Oracle官方手册.

导航到/Library/Java/JavaVirtualMachines并删除名称与以下格式匹配的目录:

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:

/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk

例如,要卸载8u6:

%rm -rf jdk1.8.0_06.jdk

请勿尝试通过从/usr/bin中删除Java工具来卸载Java.该目录是系统软件的一部分,下次您执行操作系统更新时,Apple将重置所有更改.

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.

要删除系统文件,需要在rm -rf命令之前添加sudo.

To remove system files you need to add sudo before rm -rf command.