一、
http://www.oracle.com/technetwork/java/javase/downloads/index.html
去jdk官网下载
二、安装
一路傻瓜式安装,下一步下一步
三、配置环境
vim ~/.bash_profile
配置环境
JAVA_HOME=/usr/bin/java
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME PATH CLASSPATH
使用:wq 回车退出
source .bash_profile nicknailodeMacBook-Pro:~ nicknailo$ java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
nicknailodeMacBook-Pro:~ nicknailo$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
查看 安装path
echo $PATH