尝试在Mac上卸载Java失败

时间:2019-02-23 14:39:46

标签: java java-8

我愿意在与我的版本(java 11)不兼容的机器上运行Spark shell,因此需要删除并安装兼容的版本(jdk8)。运行oracle指定的以下命令:

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

命令运行,但仍然存在Java 11:

$ java -version
java version "11" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

不确定是什么原因造成的。

1 个答案:

答案 0 :(得分:4)

这不会删除JRE或JDK。如果需要查找所有Java安装,只需启动以下命令:

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (6):
    11.0.1, x86_64: "Java SE 11.0.1"    /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
    10.0.1, x86_64: "Java SE 10.0.1"    /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
    1.8.0_40, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
    1.7.0_11, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home
    1.6.0_37-b06-434, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home
    1.6.0_37-b06-434, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home