作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图找到我的 Mac OS X 上安装的 JDK 版本的完整列表。
我确实尝试过 javac -version
但它只显示在 bashrc 中设置的当前版本。
任何帮助,将不胜感激。
最佳答案
Mac OS X 有一个很酷的二进制文件 (/usr/libexec/java_home),它从当前用户的设置返回到 Java 主目录的路径。您可能想要发布:
/usr/libexec/java_home -V
它使用如下架构打印完整的 JVM 列表:
Matching Java Virtual Machines (2):
13, x86_64: "OpenJDK 13" /Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home
1.8.0_265, x86_64: "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home
如果要打印特定 JDK 版本的 JAVA_HOME 路径,可以这样做:
/usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
您可以看到以下完整的使用选项:
Usage: java_home [options...]
Returns the path to a Java home directory from the current user's settings.
Options:
[-v/--version <version>] Filter Java versions in the "JVMVersion" form 1.X(+ or *).
[-a/--arch <architecture>] Filter JVMs matching architecture (i386, x86_64, etc).
[-d/--datamodel <datamodel>] Filter JVMs capable of -d32 or -d64
[-t/--task <task>] Use the JVM list for a specific task (Applets, WebStart, BundledApp, JNI, or CommandLine)
[-F/--failfast] Fail when filters return no JVMs, do not continue with default.
[ --exec <command> ...] Execute the $JAVA_HOME/bin/<command> with the remaining arguments.
[-R/--request] Request installation of a Java Runtime if not installed.
[-X/--xml] Print full JVM list and additional data as XML plist.
[-V/--verbose] Print full JVM list with architectures.
[-h/--help] This usage information.
关于java - 有没有办法找到 OS X 上安装的 Java 版本的完整列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63654909/
我是一名优秀的程序员,十分优秀!