1. Download the jdk file of the Linux environment
Link: https://pan.baidu.com/s/179vl1NyhnunJn828eZe_iw
Extraction code: 1234
All versions of JDK8: Java Archive Downloads - Java SE 8
2. Upload files to Linux
I am using Final Shell
3. Unzip tar -zxvf jdk1.8.0_171.tar.gz -C /usr/local/ Among them, we generally put the ones we installed in the /usr/local folder.
tar -zxvf jdk1.8.0_171.tar.gz -C /usr/local/
4. Open the configuration file vim /etc/profile
vim /etc/profile
5. Modify the configuration file
Press shift+g to quickly navigate to the end of the file, add
JAVA_HOME=/usr/local/jdk1.8.0_171
PATH=$JAVA_HOME/bin:$PATHWhere /usr/local/jdk1.8.0_171 is the path where we installed jdk, then save and exit
JAVA_HOME=/usr/local/jdk1.8.0_171
PATH=$JAVA_HOME/bin:$PATH
6. Reload the profile file to make the changed configuration file take effect immediately source /etc/profile
source /etc/profile
7. Check whether the installation is successful java -version
java -version