UBUNTU1404 Installation Configuration Java environment (JDK8)

Source: Internet
Author: User

This installation is relatively simple, there are countless teaching on the Internet, I am here to record the following, convenient in case of amnesia back to see can remember. Personal blog http://www.cnblogs.com/wdfwolf3/

1. Download and install

Anyway, we need to go to the official Download installation package (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), Choose from your own system. tar.gz suffix installation package, agree to download the agreement. Here is the Java SE installed is a more personal use of the standard version, Java ME is the Enterprise Edition, Java EE is a lightweight system mini-version. Under Directory/usr/lib, create a new folder named Java, and then unzip the downloaded installation package into this folder, sudo tar zxvf jdk-8u92-linux-x64.tar.gz-c/usr/lib/java.

2. Configure Environment variables

Open the file/etc/profile, or open ~/.BASHRC, the difference is that the previous configuration is all users, and the latter file only modifies the current user. Include in the file

Export JAVA_HOME=/USR/LIB/JAVA/JDK1. 8. 0_92  export jre_home=${java_home}/JRE  Export CLASSPATH=.:${java_home}/lib:${jre_home}/lib  export PATH=${java_home}/bin: $PATH

After you save the exit, execute the source ~/.BASHRC, and enter Java-version to see the version information indicating that the installation was successful.

3. Set the default JDK

Normally, only the JDK8 installed in the system, but if the system was previously loaded with other older versions, it would be necessary to set the following default JDK. Enter the following two lines of code in the terminal, and add the link value to the Java and Javac commands.

Update-alternatives--install/usr/bin/java java/usr/lib/java/jdk1.8.0_92/bin/java 300update-alternatives-- Install/usr/bin/javac Javac/usr/lib/java/jdk1.8.0_92/bin/javac

You can then switch between versions of Java by command Update-alternatives–config java.

UBUNTU1404 Installation Configuration Java environment (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.