Linux Ubuntu Installation JDK1.8

Source: Internet
Author: User

1 Download the official website jdk---. tar.gz file

2 Create a new folder and unzip the. tar.gz file that you just downloaded

My JDK wants to be installed under/usr/local, enter: sudo mkdir/usr/local/java

The location of my downloaded good file is ~/download input: cd ~/Download current folder extract: sudo tar-zxvf jdk--. tar.gz-c/usr/local/java


3 Setting environment variables

sudo gedit/etc/profile

Add environment variable content

#set Java Environment
Export java_home=/usr/lib/java/1.8.0_92
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH



4 Setting the default JDK

sudo update-alternatives--install/usr/bin/java java/usr/local/java/1.8.0_92/bin/java 300
sudo update-alternatives--install/usr/bin/javac javac/usr/local/java/1.8.0_92/bin/javac 300


5 Testing

java-version


display JDK version is configured successfully

[Email protected]:/home/ubuntu/public# java-version
Java Version "1.8.0_92"
Java (TM) SE Runtime Environment (build 1.8.0_92)
Java HotSpot (TM) 64-bit Server VM (build 24.65-b04, Mixed mode)

Linux Ubuntu Installation JDK1.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.