Installing and configuring JDK8 in CentOS 7

Source: Internet
Author: User

1. Check the installed JDK

grep Java

The possible results are as follows:

java-1.7.0-openjdk-1.7.0.99-2.6.5.0. El7_2.x86_64python-javapackages-3.4.1- One. El7.noarchjava-1.8.0-openjdk-headless-1.8.0.77-0. B03.el7_2.x86_64java-1.8.0-openjdk-1.8.0.77-0. B03.el7_2.x86_64tzdata-java-2016c-1. El7.noarchjavapackages-tools-3.4.1- One. El7.noarchjava-1.7.0-openjdk-headless-1.7.0.99-2.6.5.0. el7_2.x86_64

2. Removal of installed OPEN-JDK and dependent programs

Yum Remove tzdata-java-2016c-1. El7.noarch

All OPEN-JDK and other software that is dependent on OPEN-JDK will be removed at this time.

3. To Oracle download JDK8, as I downloaded is jdk-8u65-linux-x64.rpm

Execute the installation command in the corresponding directory:

RPM-IVH jdk-8u65-linux-x64.rpm

Program is installed by default to/usr/java/jdk1.8.0_65

Check the installation status:

[Email protected] jdk]# java-"1.8.0_65"1.8. 0_65-   - 25.65--1.80_65

Check the file path:

[Email protected] jdk]#WhereisJavajava:/usr/bin/java/usr/lib/java/etc/java/usr/share/java/usr/share/Mans/man1/java.1[email protected] jdk]# ll/usr/bin/javalrwxrwxrwx1Root root AMar -  One: the/usr/bin/java-/etc/alternatives/Java[[email protected] jdk]# ll/etc/alternatives/javalrwxrwxrwx1Root root theMar -  One: the/etc/alternatives/java,/usr/java/jdk1.8.0_65/jre/bin/java

To add an environment variable file:

VI /etc/profile.d/jdk8. SH

Add the following content

Java_home=/usr/java/jdk1. 8 . 0_65jre_home=/usr/java/jdk1. 8. 0_65/Jreclasspath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/Libexport Java_home jre_home CLASSPATH

Make the changes effective

Source/etc/profile

Check if it takes effect

env| grep javajre_home=/usr/java/jdk1. 8. 0_65/jrejava_home=/usr/java/jdk1. 8 . 0_65classpath=.:/ Usr/java/jdk1. 8. 0_65/lib/dt.jar:/usr/java/jdk1. 8. 0_65/lib/tools.jar:/usr/java/jdk1. 8. 0_65/jre/lib

OK, here we go.

Installing and configuring JDK8 in CentOS 7

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.