解压
shell
linxiang@192 ~ % cd /Users/linxiang/Work
linxiang@192 Work % ls -all
total 379032
drwxr-xr-x 7 linxiang staff 224 2 15 17:10 .
drwxr-x---+ 27 linxiang staff 864 2 15 17:16 ..
-rw-r--r--@ 1 linxiang staff 6148 2 15 17:10 .DS_Store
drwxr-xr-x 2 linxiang staff 64 2 15 16:41 MyRepository
drwxr-xr-x 10 linxiang staff 320 2 15 16:34 apache-maven-3.8.3
-rw-r--r--@ 1 linxiang staff 9042049 2 15 16:17 apache-maven-3.8.3-bin.tar.gz
-rw-r--r--@ 1 linxiang staff 181747413 2 15 17:08 openjdk-17.0.1_macos-aarch64_bin.tar.gz
linxiang@192 Work % tar -zxvf openjdk-17.0.1_macos-aarch64_bin.tar.gz
配置环境变量
shell
linxiang@192 Work % cd ~
linxiang@192 ~ % vim .bash_profile
export JAVA_HOME=/Users/linxiang/Work/jdk-17.0.1.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
source .bash_profile
检查版本
shell
linxiang@192 ~ % java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)