Download the JDK first
For bit:-
# cd/opt/# wget--no-cookies--no-check-certificate--header "COOKIE:GPW_E24=HTTP%3A%2F%2FWWW.ORACLE.COM%2F; Oraclelicense=accept-securebackup-cookie "" Http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz "
For bit:-
# cd/opt/# wget--no-cookies--no-check-certificate--header "COOKIE:GPW_E24=HTTP%3A%2F%2FWWW.ORACLE.COM%2F; Oraclelicense=accept-securebackup-cookie "" http://download.oracle.com/otn-pub/java/jdk/7u75-b13/ Jdk-7u75-linux-i586.tar.gz "
Unzip and move to/opt
# tar Xzf jdk-7u75-linux-x64.tar.gz
# MV Jdk1.7.0_75/opt
Set as Default virtual machine
# cd/opt/jdk1.7.0_75/# Alternatives--install/usr/bin/java java/opt/jdk1.7.0_75/bin/java Alternatives--config java
Select 4 when the following options appear
There is 4 programs which provide ' Java '. Selection Command-----------------------------------------------* 1 /usr/lib/jvm/jre-1.6.0-openjdk /bin/java + 2 /opt/jdk1.7.0_60/bin/java 3 /opt/jdk1.7.0_72/bin/java 4 /opt/jdk1.7.0_75/bin/ Javaenter to keep the current selection[+], or type selection number:4 [Press Enter]
Now you can try the Java version, the output is as follows
# Java-versionjava Version "1.7.0_75" Java (tm) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot (tm) 64-bit Server V M (build 24.75-b04, Mixed mode)
Set Environment variables
cat >>/etc/profile.d/java7. sh << eofexport java_home=/opt/jdk1. 7 . 0_75export jre_home=/opt/jdk1. 7. 0_75/jreexport PATH=\ $PATH:/opt/jdk1. 7. 0_75/bin:/opt/jdk1. 7. 0_75/jre/bineof
Re-open the terminal env|grep HOME to see the results
How to install JAVA 7 (JDK 7u75) in Centos/rhel 7/6/5 Fedora