编程语言
首页 > 编程语言> > mountain-lion – 卸载Java Mountain Lion [复制]

mountain-lion – 卸载Java Mountain Lion [复制]

作者:互联网

参见英文答案 > Uninstalling Java on Lion                                    2个
如何从Mountain Lion完全卸载Java?

我想运行Minecraft,所以我按照系统提示,我认为我安装了Java 7,然后安装了Java 6.由于其他原因,我无法让Mincraft工作,所以我删除了它,现在我想摆脱Java.

不确定它是否相关,但在终端输入“java -version”给了我
“java版”1.6.0_37“
Java(TM)SE运行时环境(版本1.6.0_37-b06-434-11M3909)
Java HotSpot(TM)64位服务器VM(版本20.12-b01-434,混合模式)“

任何帮助,将不胜感激.

解决方法:

Apple提供了一个自动Java安装程序,但没有卸载程序,因此一旦安装了Java,就无法使用自己风险的方法删除Java.

这就是说如何摆脱终端会话中的java和使用文本编辑器:

sudo rm -rf /System/Library/Java/JavaVirtualMachines/
sudo rm -rf /Library/Java/JavaVirtualMachines/*.jdk
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaEssentials.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaEssentials.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaForMacOSX107.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaForMacOSX107.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaMDNS.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaMDNS.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaSecurity.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaSecurity.plist

此时,您需要编辑安装历史记录以删除安装Java的证据.我建议先备份文件.如果您希望使用其他文本编辑器,请随意使用它,但不要使用将格式代码放在文本文件中的文字处理程序.

sudo cp /Library/Receipts/InstallHistory.plist ~/Desktop
sudo emacs /Library/Receipts/InstallHistory.plist

搜索看起来像这样的条目:

    <dict>
            <key>date</key>
            <date>2011-09-16T22:22:10Z</date>
            <key>displayName</key>
            <string>Java for Mac OS X 10.6 Update 5</string>
            <key>displayVersion</key>
            <string>1.0</string>
            <key>packageIdentifiers</key>
            <array>
                    <string>com.apple.pkg.JavaForMacOSX10.6Update5</string>
            </array>
            <key>processName</key>
            <string>Software Update</string>
    </dict>

    <dict>
            <key>date</key>
            <date>2013-01-15T11:42:35Z</date>
            <key>displayName</key>
            <string>Java for OS X 2012-006</string>
            <key>displayVersion</key>
            <string>1.0</string>
            <key>packageIdentifiers</key>
            <array>
                    <string>com.apple.pkg.JavaEssentials</string>
                    <string>com.apple.pkg.JavaForMacOSX107</string>
                    <string>com.apple.pkg.JavaSecurity</string>
                    <string>com.apple.pkg.JavaMDNS</string>
            </array>
            <key>processName</key>
            <string>Software Update</string>
    </dict>

并删除它们.您可能希望使用diff检查您的工作:

diff -u ~/Desktop/InstallHistory.plist /Library/Receipts/InstallHistory.plist | less

或其他一些文件比较工具.

您可以通过运行来测试java已经消失:

java -version

您应该看到弹出窗口要求再次安装Java.

标签:java,mountain-lion
来源: https://codeday.me/bug/20190817/1681663.html