CentOS6.5安装JDK8
上传JDK源码包,我用的jdk-8u144-linux-x64.tar.gz。解压它
tar -zxvf jdk-8u144-linux-x64.tar.gz
更改环境变量
vim /etc/profile
在最后面增加下面三句
export JAVA_HOME=/home/jdk1.8.0_144 #这里路径为自己解压的JDK的路径 export CLASSPATH=${JAVA_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
使环境变量立刻生效
source /etc/profile
最后查看java版本
java -version
[root@localhost software]# java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) [root@localhost software]#