原由 之前在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