Linux 安裝 JDK17

苏州coder發表於2024-08-07

Linux 安裝 JDK17

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

相關文章