Configure jdk environment in CentOS7.4

1. Download jdk

  First create the installation package placement location

    mkdir -p /usr/local/java

  Then you can download it directly through wget + url, or you can download it to the windows system first and then upload it through xshell or ftp. Note that the download of oracle needs to be logged in first. Here is the download address of jdk8

2. Unzip the compressed package

  tar -zxvf jdk-8u171-linux-x64.tar.gz

  After decompression, the directory is jdk1.8.0_171

3. Configure environment variables

  vi /etc/profile

  Add the following configuration at the end of the file:

  export JAVA_HOME=/usr/local/java/jdk1.8.0_171

  export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar   

  export PATH=$PATH:$JAVA_HOME/bin

4. Check if the installation is successful

  java -version

  The version information table name appears, the installation is successful

Guess you like

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