系统环境:centos7
rpm -ivh jdk-8u251-linux-x64.rpm
sudo mkdir /usr/local/maven/ sudo tar zxvf /source/kernel.tgz -C /usr/local/maven/apache-maven-3.6.3-bin.tar.gz
vi ~/.bashrc
在文件末尾添加:
export JAVA_HOME=/usr/java/jdk1.8.0_251-amd64 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.1 export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN/bin:$PATH
source ~/.bashrc
java -version java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
mvn -v Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /usr/local/maven/apache-maven-3.6.3 Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_251-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1127.10.1.el7.x86_64", arch: "amd64", family: "unix"