Linux安装JDK
1.检查JDk是否已安装
[root@localhost local]# java -version
2.解压jdk-8u171-linux-x64.tar.gz包
[root@localhost local]# tar -zxvf jdk-8u171-linux-x64.tar.gz
[root@localhost local]# mv jdk-8u171-linux-x64 /usr/local/jdk8
3.设置环境变量
[root@localhost local]# vim /etc/profile
在最前面添加:
export JAVA_HOME=/usr/local/jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
4.执行profile文件
[root@localhost local]# source /etc/profile
5.检查新安装的jdk
[root@localhost local]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)