Install Java8 on CentOS7.4

  • Upload the downloaded file to the /usr/local/ folder on the remote system;

  • First enter the directory where the compressed package is located and then enter the command to decompress the jdk (copy the following command and press shift+insert to paste);
cd /usr/local/

tar -zxvf jdk-8u161-linux-x64.tar.gz
  •  Decompression is complete;

  • Find the profile file in the /etc folder, double-click to open it with an editor (notepad++), and add it at the end of the file;
JAVA_HOME=/usr/local/jdk1.8 #你的java安装路径
JRE_HOME=/usr/local/jdk1.8/jre #jre路径
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
  • Then enter the java -version command to see if the installation is successful;

 

By:Crazy

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325236481&siteId=291194637
Recommended