Installing the JDK under Ubuntu14.04

Source: Internet
Author: User

1. Download to Oracle's website

Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Select Accept License and select the JDK download that fits your model.

2, unzip the file, modify the filename

$ sudo mkdir/usr/lib/jvm$ sudo tar zxvf jdk-8u51-linux-x64.tar.gz-c/usr/lib/jvm$ cd/usr/lib/jvm$ sudo mv jdk1.8.0_51 j Ava

3. Add Environment variables

$ sudo gedit ~/.BASHRC

Add the following:

Export Java_home=/usr/lib/jvm/java export JRE_HOME=${JAVA_HOME}/JRE  export classpath=.:${java_home}/lib:${jre_ Home}/lib  export Path=${java_home}/bin: $PATH  

4. Configuring the default JDK version

sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/java/bin/java  sudo update-alternatives-- Install/usr/bin/javac javac/usr/lib/jvm/java/bin/javac  sudo update-alternatives--install/usr/bin/jar jar/ Usr/lib/jvm/java/bin/jar   sudo update-alternatives--install/usr/bin/javah javah/usr/lib/jvm/java/bin/javah   sudo update-alternatives--install/usr/bin/javap javap/usr/lib/jvm/java/bin/javap 300   

And then execute

sudo update-alternatives--config java

If you first install the JDK, you will be prompted

There is only one alternative in link Group Java (providing/usr/bin/java):/usr/lib/jvm/java/bin/java no configuration required.

For non-initial installation, there will be different versions of the JDK option.

5. Testing

$ Java-versionjava Version "1.8.0_51" Java (tm) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot (tm) 64-bit Server V M (build 25.51-b03, Mixed mode)

Installing the JDK under Ubuntu14.04

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.