- 查看当前配置的JDK版本
java -version java version "1.8.0_211" Java(TM) SE Runtime Environment (build 1.8.0_211-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
- 查看已安装的JDK版本
/usr/libexec/java_home -V # 输出 Matching Java Virtual Machines (5): 21.0.1 (x86_64) "Oracle Corporation" - "Java SE 21.0.1" /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home 17.0.9 (x86_64) "Oracle Corporation" - "Java SE 17.0.9" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home 11.0.21 (x86_64) "Oracle Corporation" - "Java SE 11.0.21" /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home 1.8.211.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 1.8.0_211 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
- 删除JDK
# 进入指定目录 cd /Library/Java/JavaVirtualMachines # 删除 sudo rm -rf <要删除的目录>
- 清除环境变量
若要配置新的JDK,需要修改bash_profile
文件环境变量,然后source .bash_profile
使其生效。
文章来源地址https://www.toymoban.com/news/detail-756987.html
文章来源:https://www.toymoban.com/news/detail-756987.html
到了这里,关于MacOS查看JDK版本或卸载的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!