Linux version JDK download

The JDK download website: www.oracle.com/java/techno…

You can directly visit the JDK official website to download the JDK installation package for the Linux version. For Linux, download the tar.gz package.

Install the JDK in Linux

Alt +p To enter the SFTP transfer mode, run the put command to upload the JDK to the root directory in Linux.

  • For details about SFTP transfer commands in Liunx, see the previous blog: SFTP Transfer of Common Linux commands.
mv jdk-8u241-linux-x64.tar.gz /usr/local/
Copy the code

Run the mv cut command to cut the JDK installation package from the root directory to the /usr/local/ directory.

The tar - ZXVF JDK-8u241-linux-x64.tar.gz
Copy the code

Run the tar command to decompress the tar.gz package to the /usr/local/ directory.

rpm -qa | grep java
Copy the code

Query information about the installed JDK.

rm -rf jdk-8u241-linux-x64.tar.gz
Copy the code

Delete the JDK zip package.

Configure the JDK

vi /etc/profile
Copy the code

Edit the profile file in /etc/profile.

#set java environment
JAVA_HOME=/usr/local/jdk1.8.0_241
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
Copy the code

Add the above configuration to the profile, save and exit.

source /etc/profile
Copy the code

Load the file for the configuration to take effect.

Java versionCopy the code

View the JDK version.

Uninstall the JDK

rpm -e --nodeps jdk1.8.0_241
Copy the code

Unload the JDK.