In general, we will have to uninstall the Linux openjdk, and then install the Sun's JDK
First: see if the Linux-brought JDK is installed
<1># java-version//View installed Java version information
The following information is generally available:
Java Version "1.6.0"
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK 64-bit Server VM (build 1.6.0-b09, Mixed mode)
<2># rpm-qa|grep Java//view JDK information
The following information is generally available:
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
<3># yum-y Remove Java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115//Uninstall
Yum-y Remove Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
Step Two: Install Sun's JDK
<1> download Jdk-6u23-linux-x64-rpm.bin or Jdk-6u23-linux-x64.bin jdk from sun
Create a new Java folder under/usr and place the installation package in the/usr/java directory
# Mkdir/usr/java
<2> Installing the JDK
# Cd/usr/java
①jdk-6u23-linux-x64-rpm.bin File Installation
# chmod 777 Jdk-6u23-linux-x64-rpm.bin//Modify to Executable
#./jdk-6u23-linux-x64-rpm.bin//Select Yes to agree to the above agreement
# RPM-IVH Jdk-6u23-linux-x64-rpm.bin//Select Yes until installation is complete
②jdk-6u23-linux-x64.bin File Installation
# chmod 744 Jdk-6u23-linux-x64.bin//enable root user to have Execute permission (author installs with root user)
#./jdk-6u23-linux-x64.bin//Select Yes until installation is complete
Step Three: Configure environment variables
<1># Vi/etc/profile
<2> Add the following lines at the end:
Export java_home=/usr/java/jdk1.6.0_23
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar (should be the same)
Export path= $PATH: $JAVA _home/bin
<3># reboot//restart machine configuration effective
Fourth step: Test if Java is installed successfully
#javac
Is there any help to explain it? ~ Hehe, congratulations on your Java environment configuration success
Version 2:http://www.centoscn.com/image-text/config/2015/0208/4658.html
System Environment: centos-6.5 Installation Method: RPM installation software: jdk-7-linux-i586.rpm:http://www.oracle.com/technetwork/java/javase/downloads/ Index.html Inspection System original Version [[email protected] ~]# Java-versionjava version "1.7.0_24" OpenJDK Runtime Environment ( Build 1.7.0_24-b18) OpenJDK HotSpot (TM) &NBSP;CLIENT&NBSP;VM (build 24.45-b08, mixed mode, sharing) further review the JDK information: [Email protected] ~]# Rpm-qa | grep javatzdata-java-2012c-1.el6.noarchjava-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64 Uninstalls OpenJDK and does the following: [[ email protected] ~]# rpm-e--nodeps tzdata-java-2012c-1.el6.noarch[[email protected] ~]# rpm-e --nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64 Install the JDK to upload the new jdk-7-linux-i586.rpm software to/usr/local/do the following: [[ Email protected] ckb]# RPM-IVH jdk-7-linux-i586.rpmjdk is installed by default in/usr/java. Verify that the installation performs the following actions to see if the information is normal: [[email protected] bin]# java[[email protected] bin]# javac[[email protected] bin]# Java-versionjava Version "1.7.0_45" Java (TM) SE Runtime Environment (build 1.7.0_45-b18)Java HotSpot (TM) Client VMs (build 24.45-b08, mixed mode, sharing) Configuring environment variables My machine does not have to configure environment variables to perform JAVAC, java–version operations after installing jdk-7-linux-i586.rpm, so I do not configure the JDK environment variable. But for the sake of future discomfort, here is still a record how to configure, the operation is as follows: Modify the system environment variable file VI +/etc/profile append the following to the file: java_home=/usr/java/jdk1.7.0_45jre_home=/ Usr/java/jdk1.7.0_45/jrepath= $PATH: $JAVA _home/bin: $JRE _home/binclasspath=: $JAVA _home/lib/dt.jar: $JAVA _home/lib /tools.jar: $JRE _home/libexport java_home jre_home PATH classpath make the changes effective [[email protected] ~]# Source/etc/profile & nbsp; //make changes effective immediately [[email protected] ~]# echo $PATH //Viewing the PATH Value View system environment status [[email protected] ~]# Echo $PATH/usr/lib/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/java/jdk1.7.0_ 45/bin:/usr/java/jdk1.7.0_45/jre/bin:/home/ckb/bin
CentOS installation Java environment