2019独角兽企业重金招聘Python工程师标准>>>
起因 以前在windows上升级jdk1.7的时候,可以直接把原来的jdk卸载了,在安装jdk1.8,不知道能不能直接从1.7升级到1.8而不用卸载。现在在Mac上如初一辙,也这样干了,在网上搜了一堆乱七八糟的文章就开干了,然后就悲剧了。命令如下:
432 sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin433 sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefpane434 cd /usr/bin/435 ll436 rm -f wsimport437 sudo rm -f wsimport438 jmc439 find / -name JavaAppletPlugin.plugin440 rm -rf /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin441 sudo find / -name JavaAppletPlugin.plugin442 sudo rm -rf /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin443 /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin444 cd /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin445 ll446 cd ..447 ll448 rm -rf JavaAppletPlugin.plugin/449 sudo450 sudo root451 sudo -i452 jmc453 javac454 java -version455 java -version456 javac457 ll458 java459 sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin460 sudo rm -rf /Library/Preferences/461 sudo -i
如果要卸载已经安装的jdk,请参考oracle官网上的reference,不要随便在网上找个教程就弄上了,因为rm -f是不能恢复的
Uninstalling the JDK To uninstall the JDK, you must have Administrator privileges and execute the remove command either as root or by using the sudo(8) tool. Navigate to/Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format.For example, to uninstall 8u6: % rm -rf jdk1.8.0_06.jdk 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.
千万不要尝试着去删除/usr/bin/中的java*什么的
好吧,我已经做了! 会出现什么现象呢?你会发现很多变化,比如说开机界面上变成了英文什么的,关机弹窗变成了英文什么的,除此之外还有一些其他变化,如果你有幸误操作删除了系统自带的jdk1.6,你就会看到了。
那么如何恢复呢? 你可以和Apple客服掐架,当然一般是个女客服,也不会什么技术,你会发现掐了半个小时也没啥用,别问我为啥,因为我试过。浪费时间和电话费,那就去apple官网去看看Apple support什么的,也许有帮助。 进入 Apple官网,然后搜索,
进入如下页面
然后: https://support.apple.com/kb/DL1572?viewlocale=zh_CN&locale=zh_CN
下载jdk,自行安装即可。
补充一句,开发用的jdk其实和Apple自己的jdk没啥关系,可以共存的,当然oracle的1.7和1.8也可以共存的,试着搜一下jEnv就知道了。