/usr/libexec/java\u home-v< version>找到正确的jdk版本,但只在第一次更新它

pvcm50d1  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(239)

我刚买了一台带有m1处理器的macmini,我发现这种行为非常奇怪。基本上,跑步时 /usr/libexec/java_home -v ## 我可以看到,只有在第一次找到并替换jdk路径时。如果我第二次运行它,即使有一个 -V flag,我看到它找到了正确的jdk路径,但它从来没有取代旧的jdk路径,事实上,它使整个过程变得陈旧。
知道为什么吗?这是我的终端上的一个例子。

lda@Lucios-Mac-mini ~ % /usr/libexec/java_home -V   
Matching Java Virtual Machines (3):
    15 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 15" /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home
    13.0.5.1 (arm64) "Azul Systems, Inc." - "Zulu 13.35.1017" /Library/Java/JavaVirtualMachines/zulu-13.jdk/Contents/Home
    11.0.9.1 (arm64) "Azul Systems, Inc." - "Zulu 11.43.1015" /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home

lda@Lucios-Mac-mini ~ % java --version              
openjdk 15 2020-09-15
OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15+36, mixed mode, sharing)

lda@Lucios-Mac-mini ~ % export JAVA_HOME=$(/usr/libexec/java_home -v11) 

lda@Lucios-Mac-mini ~ % java --version                                 
openjdk 11.0.9.1 2020-11-04 LTS
OpenJDK Runtime Environment Zulu11.43+1015-CA (build 11.0.9.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.43+1015-CA (build 11.0.9.1+1-LTS, mixed mode)

lda@Lucios-Mac-mini ~ % export JAVA_HOME=$(/usr/libexec/java_home -v15)

lda@Lucios-Mac-mini ~ % java --version                                 
openjdk 11.0.9.1 2020-11-04 LTS
OpenJDK Runtime Environment Zulu11.43+1015-CA (build 11.0.9.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.43+1015-CA (build 11.0.9.1+1-LTS, mixed mode)

lda@Lucios-Mac-mini ~ % export JAVA_HOME=$(/usr/libexec/java_home -v13)

lda@Lucios-Mac-mini ~ % java --version                                 
openjdk 11.0.9.1 2020-11-04 LTS
OpenJDK Runtime Environment Zulu11.43+1015-CA (build 11.0.9.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.43+1015-CA (build 11.0.9.1+1-LTS, mixed mode)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题