CentOS Install JDK and configure environment variables

Source: Internet
Author: User

1, before installing the JDK to detect the system with the JDK, and uninstall it, operation as shown below
Instrumentation: Rpm-qa|grep GCJ presence of JDK

Uninstall: Uninstall all
Rpm-e–nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
Rpm-e–nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
Rpm-e–nodeps Tzdata-java-2015g-1.el7.noarch
Rpm-e–nodeps java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
Rpm-e–nodeps java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
Rpm-e–nodeps Python-javapackages-3.4.1-11.el7.noarch
Rpm-e–nodeps Papackages-tools-3.4.1-11.el7.noarch
2. Install JDK
Move the downloaded JDK to CentOS, where I put it under/usr/local/, and the download version is
jdk-7u80-linux-x64.gz, download address
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Extract JDK:

3, configuration
This is done by changing/etc/profile, which takes effect for all users, is not safe, and enters the command: Vim/etc/profile
Add at the bottom
Export java_home=/usr/local/jdk1.7.0_80
Export classpath=.: Javahome/lib/dt.jar:java_home/lib/dt.jar:java_home/lib/tools.jar
Export Path= Path:path:java_home/bin
As shown in figure:
Then save and exit
Re-enter the command: Source/etc/profile to make its configuration effective
Input: Java-version, Javac, Java detection is successful

Add: Jdk installation method in RPM format, personal recommendation
http://blog.csdn.net/czmchen/article/details/41047187
The above is purely personal notes, if there are deficiencies. Please spray ☞

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.