1. Download the jdk installation package corresponding to the system from the Oracle official website:
2. Decompress
First create a directory /usr/local/jdk/
sudo tar -xzvf jdk-8u341-linux-x64.tar.gz -C /usr/local/jdk/
3. After unzipping to this directory, configure the java environment
sudo vim ~/.bashrc
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_341
export JRE_HOME=${
JAVA_HOME}/jre
export CLASSPATH=.:JAVA_HOME/lib:JRE_HOME/lib:${
CLASSPATH}
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
4. Check whether the installation is successful
java -version