Preface
In fact, compared to Windows, the installation of JDK under Linux is simpler.
Step 1: Download and upload from the official website
- download
Address: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download the latest version 8u212 of version 1.8, size 185M
Note: If you click now and find that you cannot download, it is not because There is a fee, but you need to log in to an Oracle account. This is free, just register an account with your own email address, and then log in to download
- upload
Create a java folder in the /usr/local/ directory, upload the downloaded JDK installation package to this directory, and then decompress it
tar -zxvf jdk-8u212-linux-x64.tar.gz
After decompression:
Step 2: Configuration
Edit the profile file under etc
[root@localhost java]# vi /etc/profile
Exit and save after appending the following configuration:
export JAVA_HOME=/usr/local/java/jdk1.8.0_212
export CLASSPATH=$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
Revalidate the configuration file
[root@localhost java]# source /etc/profile
Step Three: Test
Same as the verification under Windows: you can directly input java, javac, java -version
[root@localhost java]# java -version
At this point, the installation is complete, it is still very simple, and the speed is also very fast.