Article excerpt from: http://www.iteye.com/topic/1130311
Install jdk-7u17-linux-x64.rpm (jdk with. rpm suffix)
1. First look at the OPENJDK installation package
$ RPM-QA |grep java
Tzdata-java-2013b-1.el6.noarch
Java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
Java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
2. Check the OPENJDK version
$ java-version
Java Version "1.7.0_19"
OpenJDK Runtime Environment (RHEL-2.3.9.1.EL6_4-X86_64)
OpenJDK 64-bit Server VM (build 23.7-b01, Mixed mode)
3. Uninstalling OPENJDK
Log in to the terminal with the root user
$ su Root
Password:
$ rpm-e--nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64
$ rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
$ rpm-e--nodeps Tzdata-java-2013b-1.el6.noarch
4 Installing JDK-7U17-LINUX-X64.RPM
: http://pan.baidu.com/share/link?shareid=397488&uk=638583574
$ cd/jdk1.7 in your directory
$ RPM-IVH jdk-7u17-linux-x64.rpm
Preparing ... ########################################### [100%]
1:JDK ########################################### [100%]
Unpacking JAR files ...
Rt.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/rt.pack
Jsse.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/jsse.pack
Charsets.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/charsets.pack
Tools.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/lib/tools.pack
Localedata.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/ext/localedata.pack
These errors can be ignored without affecting the JDK to install and use
5. Configure Environment variables
$vi/etc/profile
Enter o and at the end add the following:
Java_home=/usr/java/jdk1.7.0_17
Jre_home=/usr/java/jdk1.7.0_17/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Export Java_home jre_home PATH CLASSPATH
Make environment variables effective immediately
$source/etc/profile
6. Test whether the installation was successful
Enter Java,java-version,javac in turn to see the output information, such as
[Email protected] tools]# java-version
Java Version "1.7.0_17"
Java (TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot (TM) 64-bit Server VM (build 23.7-b01, Mixed mode)
CentOS installation JDK