macOS Sierra jdk的安装与JAVA_HOME Mac 环境变量设置
macOS Sierra jdk的安装以及默认路径位置
源起:
第一次随着感觉进行安装,网上查了很多资料总是无法看到安装路径,于是进行多方查找验证,书写这篇文章进行随笔记录。实践是检验真理的唯一依据。
Step1.下载路径:
http://www.oracle.com/technet...
Step2.下载jdk-9.0.1_osx-x64_bin.dmg[当然也可以选在目前最常用的jdk1.8的下载文件]
Step3.双击jdk-9.0.1_osx-x64.dmg,系统会提示双击里面的图标执行安装
Step4.执行安装默认不做任何修改点击“下一步”
Step5.一路点击“下一步”完成安装,打开“终端”,输入验证
$ 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默认安装路径
$ 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的相关内容
$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环境变量
环境变量要再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
相关推荐
MAC2007 2020-06-16
liangston 2020-06-14
昭君出塞 2020-05-25
xiaohouye 2020-05-06
lonesomer 2020-09-17
Locksk 2020-10-12
佛系程序员J 2020-10-10
gdb 2020-09-14
zousongshan 2020-08-10
hell0kitty 2020-07-28
malonely 2020-07-20
missingmuch 2020-07-19
eternityzzy 2020-07-19
wangrui0 2020-06-28
一世为白 2020-06-21
凉白开 2020-06-17
zhangwentaohh 2020-06-14