5 steps to complete the Linux build Jdk1.8 environment

1: First, create a directory in the Linux system to store JDK files. You can choose to create a new folder under the /opt directory, such as /opt/jdk.

sudo mkdir /opt/jdk

2: Copy the downloaded jdk-8u381-linux-x64.tar.gz file into the newly created directory.

sudo cp jdk-8u381-linux-x64.tar.gz /opt/jdk

3: Enter the directory and unzip the tar.gz file.

cd /opt/jdk
sudo tar -zxvf jdk-8u381-linux-x64.tar.gz

After the decompression is complete, a folder named jdk1.8.0_381 (the specific version number may vary) will be generated in the directory. Use the ls command to confirm that the folder has been decompressed correctly.

insert image description here
4: Next, open the terminal configuration file (such as .bashrc or .profile file). The default is to add the following content at the end of the file
in /etc/profile , and set the JAVA_HOME and PATH environment variables.

insert image description here

5: The configuration is basically completed. Now refresh the configuration file configuration and execute java -version to see that the jdk installation is complete.

source /etc/profile

insert image description here

Guess you like

Origin blog.csdn.net/qq_30667039/article/details/131938187