转载

CENTOS JAVA开发环境配置

系统环境:centos7

1 安装JDK

1.1 下载JDK jdk-8u251-linux-x64.rpm

1.2 安装JDK

rpm -ivh jdk-8u251-linux-x64.rpm

2 安装MAVEN

2.1 下载MAVEN apache-maven-3.6.3-bin.tar.gz

2.2 解压

sudo mkdir /usr/local/maven/
sudo tar zxvf /source/kernel.tgz -C /usr/local/maven/apache-maven-3.6.3-bin.tar.gz

3 配置系统环境变量

3.1 设置环境变量

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

3.2 使配置生效

source ~/.bashrc

4 测试安装

4.1 测试java是否安装成功

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)

4.2 测试maven是否安装成功

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"
原文  https://segmentfault.com/a/1190000023007790
正文到此结束
Loading...