[Linux] install and configure JDK1.8 and install and configure jdk1.8.

Source: Internet
Author: User

[Linux] install and configure JDK1.8 and install and configure jdk1.8.

Step 1:To download jdk in Linux, go to the (Official Website) to download the jdk Installation File;

 

View the number of Linux operating systems:

[Root @ localhost ~] # Getconf LONG_BIT

 

Since my Linux is 64-bit, I downloadedJdk-8u151-linux-x64.tar.gz

As shown in:

 

    

 

Step 2:New/Usr/javaFolderJdk-8u151-linux-x64.tar.gzPut it in this folder and switch the working directory/Usr/javaDirectory. As shown in:

 

    

 

Step 3:Configure environment variables:

 

UseVim/etc/profileEditProfileFile, in/Etc/profileAdd the following content at the bottom:

[Root @ localhost ~] # Vim/etc/profile

 

 

JAVA_HOME =/usr/java/jdk1.8.0 _ 151

PATH = $ JAVA_HOME/bin: $ PATH

CLASSPATH = $ JAVA_HOME/jre/lib/ext: $ JAVA_HOME/lib/tools. jar

Export PATH JAVA_HOME CLASSPATH

 

    

 

Step 4:UseSource/etc/profileLetProfileFile takes effect immediately

  [Root @ localhost ~] # Source/etc/profile

 

Step 5:Command Test

① When using the javac command, there will be no command not found Error

② When java-version is used, the version is java version "1.8.0 _ 151"

③ Echo $ JAVA_HOME; echo $ CLASSPATH; echo $ PATH;

    

 

OK

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.