Ubuntu 14.04 under Install JDK8

Source: Internet
Author: User

This article address: http://www.cnblogs.com/archimedes/p/ubuntu-jdk8.html, reprint please indicate source address.

1, download the latest JDK installation, address: http://www.oracle.com/technetwork/java/javase/downloads/

2, decompression jdk-8u20-linux-x64.gz, I decompression and placed under the/OPT

sudo tar zxvf./jdk-8u20-linux-x64.gz  -c/opt

3. Configure Environment variables

Vim ~/.BASHRC

Press Shit+g to add the following to the end of the file

Export JAVA_HOME=/OPT/JDK1. 8 . 0_20export jre_home=${java_home}/JRE export CLASSPATH=.:${java_home}/lib:${jre_home}/Lib Export PATH=${java_home}/bin: $PATH

Exit save and run the following command to make it effective

SOURCE ~/.BASHRC

4. Configure the default JDK

Since some Linux already have their own JDK, we need to set up the JDK we just installed as the default JDK, which can be configured below.

sudo update-alternatives--install /usr/bin/java java/opt/jdk1. 8  - sudo update-alternatives--install /usr/bin/javac javac/opt/jdk1. 8  -

The effect is as follows:

If you are prompted not to find the path, restart and try again.

5. Testing

Start the terminal and enter the following command

Java-Versionjavac

The effect is as follows:

Now that the JDK is installed

Ubuntu 14.04 under Install JDK8

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.