Ubuntu-14.04.1-desktop Install configuration JDK1.8 environment variables on the

Source: Internet
Author: User

First, download the JDK

1 wget http://download.oracle.com/otn-pub/java/jdk/8u25-b17/ jdk-8u25-linux-x64.tar.gz

(Note: If the download is not open, you can download it from the JDK website)

Second, decompression and installation

1 sudo mkdir /usr/lib/JVM2sudotar -zxvf jdk-8u25-linux-x64. tar. Gz-c/USR/LIB/JVM

Third, modify the environment variables

1 sudo vim/etc/profile

(Note: Vim is a text editor, Ubuntu is not installed by default, you can use Gedit instead)

Add to:

1 #set Java Environment 2 Export JAVA_HOME=/USR/LIB/JVM/JDK1. 8 . 0_25 3 export jre_home=${java_home}/4 export classpath=.:${java_home}/lib:${jre_home}/  Lib5 export Path=${java_home}/bin: $PATH

Save exit.

Iv. Configuring the default JDK version

To set up our installed JDK as the default JDK, do the following. (300 indicates the priority of the JDK)

1  sudo update-alternatives--install /usr/bin/java java/usr/lib/jvm/java-7  2sudo update-alternatives--install /usr/bin/javac javac/usr/lib/jvm/java-7   -

Execute code:

1 sudo

If there are multiple JDK will be listed, the native only one, shown as follows:

Multiple JDK will appear as follows (image from Network):

V. Testing

Enter in terminal

1 java-version

Shown below:

Indicates that the JDK environment is configured to complete.

You can also test the following commands:

1 Java 2 Javac

Ubuntu-14.04.1-desktop Install configuration JDK1.8 environment variables on the

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.