Install jdk1.7 in CentOS7

Source: Internet
Author: User
1, check the JDK built-in Linux has been installed # java-version2, view JDK information # rpm-qa | grepjava Display: java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxxjava-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx3, uninstall (there are several uninstall)

1. check whether the built-in JDK of Linux is installed.

# Java-version

2. View JDK information

# Rpm-qa | grep java

Display:

Java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx

Java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

3. uninstall (several detaches are available)

# Rpm-e -- nodeps java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx

# Rpm-e -- nodeps java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

There are other commands

Rpm-qa | grep gcj

Rpm-qa | grep jdk

If openjdk source cannot be found, you can uninstall it like this.

Yum-y remove java java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx

Yum-y remove java java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

4. install JDK

:( JDK1.7)

Http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm

Run the following installation command in/usr/local/src:

# Rpm-ivh jdk-7u79-linux-x64.rpm

Installed in/usr/java by default

5. check for installation

# Java-version

Display: jvav version "1.7.0 _ 79"... indicates successful

6. configure environment variables

# Vi/etc/profile

Add the following lines at the end:

JAVA_HOME =/usr/java/jdk1.7.0 _ 71

CLASS_PATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar

PATH = $ JAVA_HOME/bin: $ PATH

Export JAVA_HOME CLASS_PATH PATH

# Reboot machine configuration takes effect

Or execute the following command to take effect immediately

# Source/etc/profile

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.