下载地址:
https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html
选择 jdk-7u80-linux-x64.rpm
或者 https://download.csdn.net/download/misswell/12490111
[root@localhost ~]# ls
anaconda-ks.cfg install.log install.log.syslog jdk-7u80-linux-x64.rpm
[root@localhost ~]# rpm -ivh jdk-7u80-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
[root@localhost ~]# ls
anaconda-ks.cfg install.log install.log.syslog jdk-7u80-linux-x64.rpm
[root@localhost ~]# cd /usr/java/
[root@localhost java]# ls
default jdk1.7.0_80 latest
[root@localhost java]# cd jdk1.7.0_80/
[root@localhost jdk1.7.0_80]# pwd
/usr/java/jdk1.7.0_80
[root@localhost jdk1.7.0_80]# vim /etc/profile
[root@localhost jdk1.7.0_80]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost jdk1.7.0_80]#
其中 环境变量 /etc/profile 中添加
export JAVA_HOME=/usr/java/jdk1.7.0_80
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:PATH