Install JAVA on CentOS7

Source: Internet
Author: User
Step 1: Check whether the built-in JDK of Linux has installed and installed CentOS with OpenJdk. run java-version to view the following information: javaversion & quot; 1.6.0 & quot; openJDKRuntimeEnvironment (build1.6.0-b09) OpenJDK64-BitServerVM (build1.

Step 1: Check whether the built-in JDK of Linux is installed

The installed CentOS comes with OpenJdk and uses the java-version command. the following information is displayed:

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)

It is best to uninstall openjdk first and install the jdk of sun.

Check rpm-qa | grep java first

If yes

The following information is displayed:

Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

Uninstall:

Rpm-e -- nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Rpm-e -- nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

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

Yum-y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Yum-y remove java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

Step 2: install SUN's JDK

1. download the compressed package

2. create an application directory (put all the software you need in this directory to facilitate the same management) for example: usersoft

Mkdir/

3. copy the downloaded file to the/usersoft directory.

4. enter the following command for environment variable configuration to enter the configuration file.

[Root @ localhost java] # vi/etc/profile
Add

Export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
Export JAVA_HOME =/usersoft/java/jdk1.7.0 _ 60
Export PATH = $ JAVA_HOME/bin: $ PATH
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar

5. make the environment variable take effect. Execute the configuration file to make it take effect immediately. enter the following command:

[Root @ localhost java] # source/etc/profile

View the version currently installed in java
[Root @ localhost java] # java-version

 

End!

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.