1、创建jdk目录
mkdir -p /home/jdk
cd /home/jdk
2、下载openjdk17免安装包
wget https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
3、解压安装包
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
4、配置环境变量
vim /etc/profile #在unset i 上方插入以下环境 变量 export JAVA_HOME=/home/jdk/jdk-17.0.2/ export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
5、是变量马上生效
source /etc/profile
6、测试是否成功
java -version #会打印以下内容 openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment (build 17.0.2+8-86) OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
标签:bin,tar,jdk,openjdk17,centos7,17.0,export,HOME,安装 From: https://www.cnblogs.com/binz/p/17268441.html