Ubuntu 14.04 Installation JDK 8,ubuntu14.04

Source: Internet
Author: User

1, to the Sun's official website download


If the path cannot be found, please Baidu "Oracle technology Networkjavajava SEDownloads"

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-7u21-linux-i586.tar.gz-c/usr/lib/jvm$ cd/usr/lib/jvm$ sudo mv jdk1.7.0_21 Java

3. Add Environment variables

$ sudo vim ~/.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.

Because I am installing Ubuntu 14.04 in a virtual machine, OPENJDK is not installed by default, so there is no need to select the JDK version. If the Ubuntu version is installed on a physical machine, there are several candidates that can be used to replace Java (providing/usr/bin/java).

Select the path priority state------------------------------------------------------------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/java-6-sun/bin/java 300 manual mode \# to maintain current value Press ENTER, or type the number of your choice: 2update-alternatives: Use/usr/lib/jvm/java-8/bin/java to provide/usr/bin/java (Java) in manual mode.

5. Testing

$ Java-versionjava Version "1.7.0_21" Java (tm) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot (tm) Server VM (Buil D 23.21-B01, Mixed mode)

Ubuntu 14.04 Installation JDK 8,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.