linux server install jdk

1. Download xftp5, enter the usr directory, create a new java file, and transfer the downloaded jdk-8u171-linux-x64.tar.gz to the usr/java directory on the server



2. Use the PuTTY tool to connect to the server, enter the java file in usr through the cd command, and view the jdk-8u171-linux-x64.tar.gz compressed package through the ls command. After the file is confirmed to exist, use tar zxvf jdk -8u171-linux-x64.tar.gz decompress the file to get the decompressed jdk1.8.0_171 folder


3. Use the vim /etc/profile command to enter the profile file to configure the java environment, or you can enter the etc directory through xftp5 to find the profile file to configure the java environment, and add it at the bottom

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

export CLASSPATH=.:${JAVA_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

Configure these three lines, then press esc first, enter: we on the keyboard to save, after saving, restart the machine and enter the source /etc/profile command.

 


Four: Test whether the configuration is successful, you can enter, java -version to view the jdk configuration information

Guess you like

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