Linux (Centos7) install JDK1.8

1. Upload the compressed package to the /opt directory of the Linux server through Xftp

insert image description here
2. Unzip to the /usr/local/ directory

tar -zxvf jdk-8u161-linux-x64.tar.gz -C /usr/local/

insert image description here
3. Modify the configuration file /etc/profile and configure environment variables

 vim /etc/profile
 
 #set java environment;
   JAVA_HOME=/usr/local/jdk1.8.0_161  #注意#修改为自己的路径,和jdk文件名
   CLASSPATH=.:$JAVA_HOME/lib.tools.jar
   PATH=$JAVA_HOME/bin:$PATH
   export JAVA_HOME CLASSPATH PATH

insert image description here

4. Refresh the configuration file to check whether the installation is successful

1. source /etc/profile
2. java -version
   #出现jdk版本即安装成功

insert image description here

Guess you like

Origin blog.csdn.net/dontYouWorry/article/details/128919926