Mac set default java version

来自WHY42
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    23 (x86_64) "Oracle Corporation" - "Java SE 23" /Library/Java/JavaVirtualMachines/jdk-23.jdk/Contents/Home
    21.0.4 (x86_64) "Oracle Corporation" - "Java SE 21.0.4" /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
$ export JAVA_HOME=`/usr/libexec/java_home -v 21.0.4`

然后修改~/.zshrc

export JAVA_HOME=`/usr/libexec/java_home -v 21.0.4`