View the current system JDK: rpm-Qa | grep JDK
Result:
[Root @ dc-01 Java] # rpm-Qa | grep JDK
Java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686
Detach:
[Root @ dc-01 Java] # Yum-y remove java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686
Wait for a while to complete.
Download Sun's JDK. I downloaded
Jdk-6u37-linux-i586-rpm.bin
For a 64-bit system, download:
Jdk-6u37-linux-x64-rpm.bin
And other 64-bit dedicated packages
Create a Java directory under the/usr directory and put the downloaded file under the/usr/Java directory
Change the file to an executable file (chmod 777 ):
[Root @ dc-01 Java] # chmod 777 jdk-6u37-linux-i586-rpm.bin
Then execute this file to install it:
[Root @ dc-01 Java] #. /jdk-6u37-linux-i586-rpm.bin unpacking... checksumming... extracting... unzipsfx 5.50 of 17 February 2002, by Info-zip (Zip-Bugs@lists.wku.edu ). inflating: jdk-6u37-linux-i586.rpm inflating: sun-javadb-common-10.6.2-1.1.i386.rpm inflating: sun-javadb-core-10.6.2-1.1.i386.rpm inflating: sun-javadb-client-10.6.2-1.1.i386.rpm inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm preparing... ######################################## ### [100%] 1: JDK ####################################### #### [2, 100%] unpacking jar files... Rt. jar... JSSE. jar... Charsets. jar... Tools. jar... Localedata. jar... Plugin. jar... Javaws. jar... Deploy. jar... installing javadbpreparing... ######################################## ### [100%] 1: sun-javadb-common ################################### ####### [17%] 2: sun-javadb-core ################################### ####### [33%] 3: sun-javadb-client ################################### ####### [1, 50%] 4: sun-javadb-demo ################################### ####### [67%] 5: sun-javadb-docs ################################### ####### [83%] 6: sun-javadb-javadoc ################################### ######## [1, 100%] Java (TM) se Development Kit 6 successfully installed. product registration is free and has des between benefits: * notification of new versions, patches, and updates * special offers on Oracle products, services and Training * access to early releases and documentationproduct and system data will be collected. if your configurationsupports a browser, the JDK product registration form willbe presented. if you do not register, none of this informationwill be saved. you may also register your JDK later byopening the register.html file (located in the JDK installationdirectory) in a browser. for more information on what data registration collects and how it is managed and used, see: http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press enter to continue .....
Press enter.
Done appears.
The installation is now complete.
Configure JDK:
VI/etc/profile open the profile file and add the following at the end of the profile file:
Java_home =/usr/Java/jdk1.6.0 _ 37 Path = $ java_home/bin: $ pathclasspath =.: $ java_home/lib/DT. jar: $ java_home/lib/tools. jarexport java_homeexport pathexport classpath
Save and close the profile file, and run the source/etc/profile command to make the modification take effect.
Run Java-version to check the Java version:
[Root @ dc-01 Java] # Java-version
Java version "1.6.0 _ 37" Java (TM) se Runtime Environment (build 1.6.0 _ 37-b06) Java hotspot (TM) Client VM (build 12-b01, mixed mode, sharing) [root @ dc-01 Java] #
========================================================== ==========
So far, the entire installation process is complete.