OpenJDK and installation Sunjdk method of CentOS system deleting self-band

Source: Internet
Author: User
Tags mixed

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.