[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