Detailed tutorial on JDK download, installation and environment configuration in Linux

1. Download the JDK installation package

1. Official website link: https://www.oracle.com/java/technologies/downloads/archive/
2. Scroll down to select the version you want to install (here, we take Java SE 8 as an example)

Insert image description here

3. Download the corresponding Linux versionInsert image description here

2. Install JDK

1. Open Linux and select the storage directory

Insert image description here

2. Upload the installation package you just downloaded

(Just choose a software that can upload local files to Linux. MobaXterm is recommended)
Insert image description here

#Enter the folder directory: cd /usr/local/java/
#View files: ls
#Extract the current file: tar -zxvf package name

Insert image description here

3. Check whether the installation is successful

Insert image description here

4. If it is the openjdk version, it comes with it, just delete it.

yum remove openjdk

3. Configure environment variables

1. Open the profile file and modify the configuration: vim /etc/profile

Insert image description here

2. Add the following content (press i to enter file editing mode)

export JAVA_HOME=/usr/local/java/jdk1.8.0_371
export PATH=$ JAVA_HOME/bin:$PATH

Insert image description here

3. After adding, press ESC +: +wq (be sure to save!!!)
4. Refresh the resources: source /etc/profile
5. Check whether it is configured properly: echo $PATH

Insert image description here

Guess you like

Origin blog.csdn.net/Mredust/article/details/131581921