View the current system Jdk:rpm-qa | grep jdk
The results obtained:
The code is as follows |
Copy Code |
[Root@dc-01 java]# Rpm-qa | grep JDK java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686 |
Uninstall OPENJDK:
The code is as follows |
Copy Code |
[Root@wx32 local]# Java-version 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) [Root@wx32 local]# Rpm-qa | grep java Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5 java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 [root@wx32 local]# rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5 [root@wx32 local]# rpm-e--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 [Root@wx32 local]# Java-version -bash:/usr/bin/java:no such file or directory |
Install SUNJDK:
The code is as follows |
Copy Code |
[root@wx32 local]# mkdir Java [root@wx32 local]# CD java/ [Root@wx32 java]# pwd /usr/local/java [root@wx32 java]# wget Http://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-linux-i586.bin [root@wx32 java]# chmod +x jdk-6u45-linux-i586.bin [root@wx32 java]#./jdk-6u45-linux-i586.bin |
After unpacking the installation package, configure the environment variables:
The code is as follows |
Copy Code |
[Root@wx32 java]# Vi/etc/profile Add on the last line of the file (note the installation path): Java_home=/usr/local/java/jdk1.6.0_45 Jre_home=/usr/local/java/jdk1.6.0_45/jre Path= $PATH: $JAVA _home/bin: $JRE _home/bin Classpath=.: $JAVA _home/lib/jt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib Export Java_home jre_home PATH CLASSPATH |
After you save the exit, make it effective:
code is as follows |
copy code |
[root@wx32 java]# source/etc/profile [root@wx32 java]# java-version Java Version "1.6.0_45" Java (TM) SE Runtime Environ ment (build 1.6.0_45-b06) Java HotSpot (TM) Server VM (build 20.45-b01, Mixed mode) |