Install and configure JDK 8 in CentOS 7

Source: Internet
Author: User
Tags java jdk 8

Install and configure JDK 8 in CentOS 7

Installation instructions

System Environment: CentOS 7
Installation Method: rpm Installation
Software: jdk-8u25-linux-x64.rpm
: Http://www.Oracle.com/technetwork/java/javase/downloads/index.html

Recommendation: install Java JDK 8 in CentOS 7/6. 5/6. 4.

Check the original system version
[Root @ zck ~] # Java-version
Java version "1.7.0 _"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build between 0-b12, mixed mode)

To further view the JDK information:
[Root @ localhost ~] # Rpm-qa | grep java
Javapackages-tools-3.4.1-6.el7_0.noarch
Tzdata-java-2014i-1.el7.noarch
Java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64
Java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64
Python-javapackages-3.4.1-6.el7_0.noarch

 


Uninstall OpenJDK and perform the following operations:
[Root @ localhost ~] # Rpm-e -- nodeps tzdata-java-2014i-1.el7.noarch
[Root @ localhost ~] # Rpm-e -- nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64
[Root @ localhost ~] # Rpm-e -- nodeps java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64

 


Install JDK


Upload new jdk-8u25-linux-x64.rpm software to/usr/local/to perform the following operations:
[Root @ zck local] # rpm-ivh jdk-8u25-linux-x64.rpm


JDK is installed in/usr/java by default.


Verify Installation

Perform the following operations to check whether the information is normal:
[Root @ localhost ~] # Java
[Root @ localhost ~] # Javac
[Root @ localhost ~] # Java-version
Java version "1.8.0 _ 25"
Java (TM) SE Runtime Environment (build 1.8.0 _ 25-b17)
Java HotSpot (TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Configure Environment Variables

After installing the jdk-7-linux-x64.rpm on my machine, I can still perform the javac and java-version operations without configuring environment variables, so I didn't configure JDK environment variables. However, for future discomfort, we should record how to configure it as follows:
Modify the system environment variable File
Vi +/etc/profile

Append the following content to the file:
JAVA_HOME =/usr/java/jdk1.8.0 _ 25
JRE_HOME =/usr/java/jdk1.8.0 _ 25/jre
PATH = $ PATH: $ JAVA_HOME/bin: $ JRE_HOME/bin
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib
Export JAVA_HOME JRE_HOME PATH CLASSPATH

Make the modification take effect
[Root @ localhost ~] # Source/etc/profile // make the modification take effect immediately
[Root @ localhost ~] # Echo $ PATH // view the PATH value

View system environment status
[Root @ localhost ~] # Echo $ PATH
/Usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin: /usr/java/jdk1.8.0 _ 25/bin:/usr/java/jdk1.8.0 _ 25/jre/bin

Install JDK 1.8.0 _ 25 on Ubuntu 14.04 and configure Environment Variables

 

Build a JDK environment using CentOS

 

Install JDK 1.8.0 _ 25 on Ubuntu 14.04 and configure Environment Variables

 

Install Oracle JDK 14.04 on Ubuntu 1.8 LTS

 

CentOS6.3 install JDK and environment Configuration

 

Install JDK 8 on Ubuntu 14.04

 

Install JDK graph analysis in Ubuntu

 

This article permanently updates the link address:

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.