1 jdk安装
文件自行官网下载
http://www.oracle.com/technetwork/java/javase/downloads/index.html
解压:tar xf jdk-8u121-linux-x64.tar.gz
把文件移到local目录:mv jdk1.8.0_121 /usr/local/
进入目录:cd /usr/local/jdk1.8.0_121
2 添加环境变量
vi /etc/profile
最后添加:
export JAVA_HOME=/usr/local/jdk1.8.0_121
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
文件自行官网下载
http://www.oracle.com/technetwork/java/javase/downloads/index.html
解压:tar xf jdk-8u121-linux-x64.tar.gz
把文件移到local目录:mv jdk1.8.0_121 /usr/local/
进入目录:cd /usr/local/jdk1.8.0_121
2 添加环境变量
vi /etc/profile
最后添加:
export JAVA_HOME=/usr/local/jdk1.8.0_121
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
3 检测jdk是否安装成功.
java -version