MAC
(1)下载JDK
http://www.oracle.com/technetwork/java/javase/downloads/index.html
(2)接受下载协议,下载类型如下:
Mac OS X x64 package
如:
jdk-8u51-macosx-x64.dmg
(3)配置环境变量:
举个例子:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH: export JAVA_HOME export PATH export CLASSPATH
(4)测试一下:
$ java -version
环境ok的情况下,命令行会输入如下内容:
java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixe