centos7 安装jdk8和maven3
标签(空格分隔): java,linux
jdk
第一种安装:
yum install java-1.8.0-openjdk
/usr/lib/jvm/ 默认安装目录
第二种:
1.下载包tar包
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.创建目录并解压
cd /usr/local/
mkdir java
cd java
tar -zxvf jdk-8u191-linux-x64.tar.gz
3.设置环境变量
vim /etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_191
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
:wq
source /etc/profile
4.测试
java -version
maven
1. 创建目录下载tar包
mkdir -p /usr/local/maven/
cd /usr/local/maven/
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
2. 解压
tar -zxvf apache-maven-3.3.9-bin.tar.gz
3. 设置环境变量
vim /etc/profile
M2_HOME=/usr/local/maven/apache-maven-3.3.9
export PATH=${M2_HOME}/bin:${PATH}
:wq
source /etc/profile
4. 测试
mvn --version
原文地址:https://www.cnblogs.com/yanweifeng/p/12189881.html
时间: 2024-10-29 11:52:24