原由 之前在windows上升级jdk1.7的时候,能够直接把原来的jdk卸载了,在安装jdk1.8,不知道能不能直接从1.7升级到1.8而不用卸载。如今在Mac上如初一辙,也这样干了,在网上搜了一堆乱七八糟的文章就开干了,而后就悲剧了。命令以下:java
432 sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 433 sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefpane 434 cd /usr/bin/ 435 ll 436 rm -f wsimport 437 sudo rm -f wsimport 438 jmc 439 find / -name JavaAppletPlugin.plugin 440 rm -rf /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin 441 sudo find / -name JavaAppletPlugin.plugin 442 sudo rm -rf /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin 443 /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin 444 cd /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin.plugin 445 ll 446 cd .. 447 ll 448 rm -rf JavaAppletPlugin.plugin/ 449 sudo 450 sudo root 451 sudo -i 452 jmc 453 javac 454 java -version 455 java -version 456 javac 457 ll 458 java 459 sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 460 sudo rm -rf /Library/Preferences/ 461 sudo -i
若是要卸载已经安装的jdk,请参考oracle官网上的reference,不要随便在网上找个教程就弄上了,由于rm -f是不能恢复的windows
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.oracle
千万不要尝试着去删除/usr/bin/中的java*什么的app
好吧,我已经作了! 会出现什么现象呢?你会发现不少变化,好比说开机界面上变成了英文什么的,关机弹窗变成了英文什么的,除此以外还有一些其余变化,若是你有幸误操做删除了系统自带的jdk1.6,你就会看到了。code
那么如何恢复呢? 你能够和Apple客服掐架,固然通常是个女客服,也不会什么技术,你会发现掐了半个小时也没啥用,别问我为啥,由于我试过。浪费时间和电话费,那就去apple官网去看看Apple support什么的,也许有帮助。 进入 Apple官网,而后搜索,orm
进入以下页面教程
而后: https://support.apple.com/kb/DL1572?viewlocale=zh_CN&locale=zh_CN开发
下载jdk,自行安装便可。rem
补充一句,开发用的jdk其实和Apple本身的jdk没啥关系,能够共存的,固然oracle的1.7和1.8也能够共存的,试着搜一下jEnv就知道了。get