https://blog.csdn.net/mambaMentality/article/details/121399637 上传jdk
找到jdk安装包 上传文件jdk-8u171-linux-x64.tar.gz
链接:https://pan.baidu.com/s/15-YQfwaOt0531ClJV4gs6A
提取码:0648
https://blog.csdn.net/mambaMentality/article/details/121399637 解压jdk
tar -zxf jdk-8u171-linux-x64.tar.gz
修改文件夹名称
mv jdk1.8.0_171/ jdk8/
将jdk放到/usr/local下
mv jdk8/ /usr/local/jdk8
https://blog.csdn.net/mambaMentality/article/details/121399637 配置环境变量
vim /etc/profile
将下面的环境变量写到配置文件最下面
#set java environment
JAVA_HOME=/usr/local/jdk8
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
# set mvn
export M2_HOME=/data/software/java/maven/apache-maven-3.1.1 #maven地址
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
https://blog.csdn.net/mambaMentality/article/details/121399637 重载配置文件(重要)
source /etc/profile
https://blog.csdn.net/mambaMentality/article/details/121399637 检查环境变量
java -version
本文转自 https://blog.csdn.net/mambaMentality/article/details/121399637 ,如有侵权,请联系删除。