1. 下载安装包
mkdir /home/jdk17
wget <https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz> -P /home/jdk17/
或
wget <http://49.232.8.65/jdk/jdk17/jdk-17_linux-x64_bin.tar.gz> -P /home/jdk17/
2. 解压
tar xf /home/jdk17/jdk-17_linux-x64_bin.tar.gz -C /home/jdk17/
3. 配置环境变量
vim /etc/profile #末尾添加如下位置
export JAVA_HOME=/home/jdk17/jdk-17.0.1
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH
4. 使环境变量生效
source /etc/profile
5. 验证
java
javac
java -version
参考资料
https://www.cnblogs.com/shenyuanhaojie/p/15744357.html