Install configuration JDK under Linux

Source: Internet
Author: User

One. Download JDK
Download JDK to Oracle website (www.oracle.com)


Two. Unzip the installation
Create a new directory under/USR/java
1.cd/usr
2.sudo mkdir Java
Access to the downloaded JDK directory via the CD command
sudo tar zxvf./jdk-8u91-linux-x64.tar.gz-c/usr/java


Three. Configure environment variables (environment variables that work for all users)
Modify the/etc/profile file if your computer is only used as a developer when using this method, because all the user's shell has the right to use this environment variable, may bring security issues to the system


Vi/etc/profile
Add at the end of an open file

Export java_home=/usr/java/jdk1.8.0_91
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH


Four. Configure the default JDK (typically this step can be omitted)
In order to make the JDK version we just installed can be the default JDK version, we will also make the following configuration.
1.sudo update-alternatives--install/usr/bin/java Java/usr/java/jdk1.8.0_91/bin/java 300
2.sudo update-alternatives--install/usr/bin/javac Javac/usr/java/jdk1.8.0_91/bin/javac 300


Five. Testing
Java-version
The results shown below indicate that the Java command is ready to run
Java Version "1.8.0_91"
Java (TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot (TM) 64-bit Server VM (build 25.91-b14, Mixed mode)

Install configuration JDK under Linux

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.