1.解压jdk
[root@VM_22_46_centos install]# tar -zxvf jdk-8u131-linux-x64.tar.gz ^C
2.移动到指定位置
[root@VM_22_46_centos install]# mv jdk1.8.0_131/ /usr/local/condition/java/
3.修改环境变量配置文件
[root@VM_22_46_centos jdk1.8.0_131]# vim /etc/profile
JAVA_HOME=/usr/local/condition/java/jdk1.8.0_131
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
4.立刻生效配置文件
source /etc/profile
5. 查看java是否安装成功
java -version
6.看到这些就说明安装成功了
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
原文地址:http://12275610.blog.51cto.com/12265610/1917942