First to official find:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Download jdk1.7 using the wget command
# When you need to download the JDK, it is not possible to use the wget command directly. The solution is as follows:
# just need to add a special cookie on wget to get it done, download the full command of the latest version of Jdk-7u21:
wget--no-cookie--header "cookie:gpw_e24=http%3a%2f%2fwww.oracle.com%2f" http://download.oracle.com/otn-pub/java/ Jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz? Authparam=1461458726_3c8fc7f6eaa41b7c74384bfbbc4fff24
# and if unable to establish SSL connection is present, add –no-check-certificate after wget, command as follows:
wget--no-cookie--no-check-certificate--header "cookie:gpw_e24=http%3a%2f%2fwww.oracle.com%2f"/HTTP/ Download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz? Authparam=1461458726_3c8fc7f6eaa41b7c74384bfbbc4fff24
Setting the JDK environment variable here is the global setting method, which is to modify Etc/profile, which is a common environment variable for all users.
sudo gedit/etc/profile
After opening, add at the end
Export java_home=/usr/local/java/jdk1.7.0_45
Export JRE_HOME=/USR/LOCAL/JAVA/JDK1.7.0_45/JRE
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $PATH
and then save
Source/etc/profile
Centos Command mode download JDK1.7