After the CentOS operation is installed, the system has its own openjdk, first view the relevant installation information:
1. You can use the Java-version command to view the system's own version information with JDK
$ 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)
2. Then use the RPM to view the 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.5.0-openjdk-1.5.0.19-2.3.9.1.el6_4.x86_64
java-1.6.0-openjdk-doc-****
java-1.5.0-openjdk-doc****
Tzdata-java-2012b-1.el6.noarch
Lib****.noarch
***
3. Uninstall OPENJDK. Delete the OPENJDK related to the Noarch related to the above list.
$RPM-E--nodepsjava-1.5.0-openjdk-1.5.0.19-2.3.9.1.el6_4.x86_64
$RPM-E--nodepsjava-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
$RPM-E--nodeps tzdata-java-2012b-1.el6.noarch
$ rpm-e--nodeps 1.6.0-openjdk-doc-****
$RPM-E--nodeps 1.5.0-openjdk-doc****
$ rpm-e--nodepslib****.noarch 4. To install your own JDK
JDK Download Address: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
Upload to Linux server after download:
Then unzip the source package:
#tar zxvfjdk-7u17-linux-x64.tar.gz-c/usr/
#cd/usr/
#mv Jdk1.7.17/java
5. Configure Environment variables
$vim/etc/profile
At the end of the profile file, 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_homejre_home PATH CLASSPATH
6. Make configuration immediately effective $source/etc/profile
7. Verify that the installation is successful
To enter Java in turn, Java-version,javac can view installation information for the JDK, indicating that the installation was successful
8. View Java_home
$echo $JAVA _home
For the configuration under Windows and the use of Eclipse, see the blog:http://blog.csdn.net/sunny2038/article/details/6955806