macOS Sierra jdk的安裝以及默認路徑位置
源起:
第一次隨着感受進行安裝,網上查了不少資料老是沒法看到安裝路徑,因而進行多方查找驗證,書寫這篇文章進行隨筆記錄。實踐是檢驗真理的惟一依據。html
Step1.下載路徑:
http://www.oracle.com/technet...java
Step2.下載jdk-9.0.1_osx-x64_bin.dmg[固然也能夠選在目前最經常使用的jdk1.8的下載文件]macos
Step3.雙擊jdk-9.0.1_osx-x64.dmg,系統會提示雙擊裏面的圖標執行安裝oracle
Step4.執行安裝默認不作任何修改點擊「下一步」ui
Step5.一路點擊「下一步」完成安裝,打開「終端」,輸入驗證spa
$ java --version java 9.0.1 Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
Step6.查看macos的jdk默認安裝路徑code
$ cd /Library/Java/JavaVirtualMachines/ $ ls -al total 0 drwxr-xr-x 4 root wheel 136 10 22 21:50 . drwxrwxr-x 4 root wheel 136 10 22 20:42 .. drwxr-xr-x 3 root wheel 102 10 22 20:42 jdk-9.0.1.jdk drwxr-xr-x 3 root wheel 102 10 22 21:50 jdk1.8.0_151.jdk
Step7.終端輸入命令查看jdk的相關內容htm
$cd jdk-9.0.1.jdk/Contents $ ls -al total 8 drwxrwxr-x 5 root wheel 170 10 22 21:46 . drwxr-xr-x 3 root wheel 102 10 22 20:42 .. drwxrwxr-x 10 root wheel 340 10 22 21:46 Home -rw-rw-r-- 1 root wheel 1576 9 28 11:54 Info.plist drwxrwxr-x 3 root wheel 102 10 22 21:46 MacOS
Step8.jdk在macOS的廬山真面露圖片
$ cd Home $ ls -al total 16 drwxrwxr-x 10 root wheel 340 10 22 21:46 . drwxrwxr-x 5 root wheel 170 10 22 21:46 .. -rw-rw-r-- 1 root wheel 158 9 28 11:54 README.html drwxrwxr-x 49 root wheel 1666 10 22 21:46 bin drwxrwxr-x 7 root wheel 238 10 22 21:46 conf drwxrwxr-x 11 root wheel 374 10 22 21:46 include drwxrwxr-x 99 root wheel 3366 10 22 21:46 jmods drwxrwxr-x 99 root wheel 3366 9 28 11:54 legal drwxrwxr-x 94 root wheel 3196 10 22 21:46 lib -rw-rw-r-- 1 root wheel 1946 9 28 11:54 release
Step9.在MAC中設置JAVA_HOME環境變量get
環境變量要再etc目錄下的profile文件中配置,這樣纔是永久的配置。
cd /etc sudo vi profile password:
輸入以下內容:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home export JAVA_HOME
保存。而後重啓或者註銷,使環境變量的配置起做用。
Step10.重啓終端,輸入echo驗證環境變量 【完美】
$ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home