Mac set default java version:修订间差异
小 Riguz移动页面Mac:设置Java版本至Mac set default java version,不留重定向 |
无编辑摘要 |
||
第1行: | 第1行: | ||
<source lang="bash"> | <source lang="bash"> | ||
/usr/libexec/java_home -V | $ /usr/libexec/java_home -V | ||
export JAVA_HOME=`/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` | |||
</source> | </source> | ||
然后修改~/.zshrc | 然后修改~/.zshrc | ||
<pre> | <pre> | ||
export JAVA_HOME=`/usr/libexec/java_home -v | export JAVA_HOME=`/usr/libexec/java_home -v 21.0.4` | ||
</pre> | </pre> | ||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2024年9月20日 (五) 09:25的版本
$ /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`