The first step: download the Linux environment jdk1.8, please go to the (official website) to download the JDK installation files;
To view the Linux operating system number of bits:
[Email protected] ~]# getconf long_bit
Since my Linux is 64-bit, I downloaded the jdk-8u151-linux-x64.tar.gz
As shown in the following:
Step Two: create a new /usr/java folder, place the jdk-8u151-linux-x64.tar.gz in the folder, and switch the working directory to /usr/java Directory. As shown in the following:
Step Three: Configure environment variables:
Using vim/etc/profile to edit the profile, add the following at the bottom of the /etc/profile :
[Email protected] ~]# 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
Fourth Step: use source/etc/profile to make the profile effective immediately
[Email protected] ~]# Source/etc/profile
Fifth Step: command test
①, command not found error is not present with JAVAC commands
②, using Java-version, appears as Java version "1.8.0_151"
③, Echo $JAVA _home;echo $CLASSPATH; Echo $PATH;
Ok
"Linux" Installation configuration JDK1.8