首页 > 代码库 > Mac 环境配置 JDK

Mac 环境配置 JDK

 

1.下载jdk 1.8:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

 

2. 安装jdk,安装路径:

/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home

修改路径:

vim /etc/profile
在结尾加上,如下代码:
1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
2 JAVA_BIN=/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home/bin 
3 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$PATH:$JAVA_HOME/bin
4 
5 export JAVA_HOME
6 export JAVA_BIN
7 export CLASSPATH
8 export PATH

 

无法保存时,

:set noreadonly

:wq!

 

 

然后运行

source /etc/profile

检查下就行了

Mac 环境配置 JDK