The file package can be downloaded from the network disk:
Link: https://pan.baidu.com/s/1bJcTaDhXLVrBYb_kNPyq3g?pwd=1024
Extraction code: 1024
1. Upload the jdk file
mkdir -p /home/java
Upload the folder to /home/java/
Or upload the tar.gz file and decompress it with tar -zxvf
2. Configure JDK environment variables
vi /etc/profile
Add the following configuration
#注意这块改成上传包的路径 在配置文件最后面加即可
export JAVA_HOME=/home/java
export JRE_HOME=/home/java/jdk1.8.0_131
export CLASSPATH=$JRE_HOME/lib/rt.jar:$JRE_HOME/lib/ext
export PATH=$PATH:$JRE_HOME/bin
As shown in the picture:
Use the command to make the environment variable take effect
source /etc/profile
3. Test whether the configuration is successful
java -version
As shown in the picture: