1、 Oracle official website to download the Linux 64-bit installation package of JDK8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、 Upload the installation package to CentOS server via SFTP
3、 Unzip to the specified directory/usr
[ root@localhost ~]# tar -zxvf jdk-8u201-linux-x64.tar.gz -C /usr
4、 Modify the environment variable vi /etc/profile
Add the following three lines at the end
export JAVA_HOME=/usr/jdk1.8.0_201
export PATH=
export CLASSPATH=.:
After saving, source /etc/profile makes the environment variable take effect immediately
5、 Verify that the JDK is installed successfully
java -version
javac compilation
java execution verification (java is followed by the class name in the java file)
Recommended Posts