Linux under RPM for loading and unloading JDK

Source: Internet
Author: User

1. If Linux is CentOS, please uninstall OPENJDK first

Java-version, there will be the following information:

java version  "1.6.0_24

Uninstall the default
Log in to the system with the root user and open a terminal input
# Rpm-qa|grep GCJ
Display content contains the following two lines of information
# JAVA-1.4.2-GCJ-COMPAT-1.4.2.0-27JPP
# JAVA-1.4.2-GCJ-COMPAT-DEVEL-L.4.2.0-27JPP
Unloading
# RPM-E JAVA-1.4.2-GCJ-COMPAT-DEVEL-L.4.2.0-27JPP
# RPM-E JAVA-1.4.2-GCJ-COMPAT-L.4.2.0-27JPP

Or

See Rpm-qa First | grep java

The following information is displayed:

java-1.5.0-gcj-1.5.0.0-29.1.el6.i686
java-1.6.0-openjdk-1.6.0.0-1.50.1.11. 5.e16_3-i386
Uninstall OPENJDK:

RPM-E--nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.i686
RPM-E--nodeps java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.e16_3-i386
There are some other commands to uninstall OPENJDK

Rpm-qa | grep GCJ

Rpm-qa | grep JDK
If OpenJDK source cannot be found, you can also uninstall this

Yum-y Remove Java java-1.5.0-gcj-1.5.0.0-29.1.el6.i686
Yum-y remove Java java-1.6.0-openjdk-1.6.0.0-1.50.1.11. 5.e16_3-i386

(Uninstall any other JDK you have installed and use RPM-E <javaXXXXX>
Uninstall the RPM version of the JDK:

#rpm-qa|grep JDK

Display: Jdk-1.6.0_10-fcs
Uninstall: #rpm-e--nodeps Jdk-1.6.0_10-fcs )

2. Add executable permissions and install:
#chmod +x jdk-7u25-linux-x64.rpm
#rpm-IVH jdk-7u25-linux-x64.rpm
Execution Result:
[Email protected] java]# RPM-IVH jdk-7u25-linux-x64.rpm
Preparing ... ########################################### [100%]
1:JDK ########################################### [100%]
Unpacking JAR files ...
Rt.jar ...
Jsse.jar ...
Charsets.jar ...
Tools.jar ...
Localedata.jar ...

3. Configure Environment variables
① Enter Edit Profile

[Plain] View plaincopy
#vim/etc/profile
② at the end of the profile file to add the following:
Export java_home=/usr/java/jdk1.7.0_25
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
③ Save and exit, perform the following

[Plain] View plaincopy
#source/etc/profile
4. View Java version

[Plain] View plaincopy
[Email protected] java]# java-version
Java Version "1.7.0_25"
Java (TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot (TM) 64-bit Server VM (build 23.25-b01, Mixed mode)

Linux under RPM for loading and unloading JDK

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.