安装jdk-17
下载JDK 17的Linux压缩包
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
创建一个目录用于存放JDK
sudo mkdir /usr/local/java
解压JDK压缩包
sudo tar -xzf jdk-17_linux-x64_bin.tar.gz -C /usr/local/java
配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk-17.0.10
export PATH=$PATH:$JAVA_HOME/bin
更新环境变量
source /etc/profile
查看PATH
echo $PATH
验证安装
java -version