Ubuntu 14.04 Installing JDK 8

Source: Internet
Author: User


1, install the JDK, reference
1. Download JDK 8
Choose to download the latest JDK version of JDK 8 from http://www.oracle.com/technetwork/java/javasebusiness/downloads/.

2. Unzip the file
$ sudo MKDIR/USR/LIB/JVM
$ sudo mv jdk-8u5-linux-i586.tar.gz/usr/lib/jvm/

$ cd/usr/lib/jvm/
$ sudo tar-zxvf jdk-8u5-linux-i586.tar.gz
$ rm./jdk-8u5-linux-i586.tar.gz

3. Configuration

$ sudo gedit/etc/environment

Modify path in environment, append JDK path, add classpath and Java_home as follows:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.8.0_05/bin"
Classpath= "/usr/lib/jvm/jdk1.8.0_05/lib"
Java_home= "/usr/lib/jvm/jdk1.8.0_05"

And then we're going to tell the system that we're using Sun's JDK, not OPENJDK:

$ sudo update-alternatives--install/usr/bin/java java /usr/lib/jvm/jdk1.8.0_05/bin/java
$ sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jvm/ Jdk1.8.0_05/bin/javac
$ sudo update-alternatives--config java
has 2 candidates that can be used to replace Java (providing/usr/bin/java).
Select     path                             and nbsp         priority   Status
------------------------------------------------------------
* 0      /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061   Auto mode
  1      / Usr/lib/jvm/java-6-openjdk/jre/bin/java   1061   Manual mode
  2      /usr/lib/jvm/jdk1.8.0_ 05/bin/java             300      Manual mode
to maintain the current value [*] press ENTER, or type the number of your selection: 2

As shown above, this will set up the Java to be used.

4. Test Run Java-version

The installation succeeds as follows:

Java Version "1.8.0_05"
Java (TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot (TM) Server VM (build 25.5-b02, Mixed mode)

Ubuntu 14.04 Installing JDK 8

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.