1.首先要去下载好JDK
Java SE 8的官方网址是http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.解压文件
[root@acb40835 software]# tar -xvf jdk-8u65-linux-x64.tar.gz
3.添加环境变量
[root@acb40835 software]# vim /etc/profile
添加:
export JAVA_HOME=/home/software/jdk1.8.0_65 export JRE_HOME=/home/software/jdk1.8.0_65/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
4.环境变量生效
[root@acb40835 software]# source /etc/profile
5.检查安装是否成功
[root@acb40835 software]# java -version