CentOS 6.5 Installation jdk1.8

Source: Internet
Author: User

1 , source package preparation:

First download the jdk-8u66-linux-x64.tar.gz on the official website,

Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2 , unzip the source package

Create a new Java folder from the terminal in the/usr/local directory, command line:

sudo mkdir /usr/local/java

Then copy the download to the archive into the Java folder, the command line:

Enter the directory where the JDK source package resides

CP jdk-8u66-linux-x64. tar. Gz/usr/local/java

Then go to the Java directory, command line:

Cd/usr/local/java

Unzip the Tarball, command line:

sudo tar zxvf jdk-8u66-linux-x64. tar. gz

You can then delete the compressed package, command line:

sudo RM jdk-8u66-linux-x64. tar. gz
3 , set the JDK environment variable

The global setting method here is to modify Etc/profile, which is a common environment variable for all users.

VI /etc/profile

After opening, add at the end

Java_home=/usr/local/java/jdk1. 8 . 0_66jre_home=/usr/local/java/jdk1. 8. 0_66/Jreclasspath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/LibPATH = $JAVA _home/bin: $PATHexport PATH java_home CLASSPATH

Make environment variables effective

Source/etc/profile

See if your configuration is correct

Echo $JAVA _home Echo $CLASSPATH Echo $PATH
4 , modify the default JDK

If the system already has a different version of Java installed

Update-alternatives--install /usr/bin/java java/usr/java/jdk1. 8  - update-alternatives-install /usr/bin/javac javac/usr/java/jdk1. 8  - Update-alternatives--config javaupdate-alternatives--config Javac
5 , check whether the installation is successful

In the terminal

Java-version

To see if the installation was successful, the success is shown below

" 1.8.0_66 "  1.8. 0_66-25.65-b01, Mixed mode)
Reference:

Http://www.centoscn.com/image-text/install/2014/0827/3585.html

http://my.oschina.net/zhangjie830621/blog/280935

Linux (CentOS) installation jdk (. tar.gz) and configure

CentOS 6.5 Installation jdk1.8

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.