有没有办法在 32 位环境中检测 64 位 java 安装? Java 部署工具包没有检测到任何内容,但我想知道是否有某种 secret 浏览器方法可以检测 64 位安装客户端。
最佳答案
When writing Java code, how do I distinguish between 32 and 64-bit operation?
There's no public API that allows you to distinguish between 32 and 64-bit operation. Think of 64-bit as just another platform in the write once, run anywhere tradition. However, if you'd like to write code which is platform specific (shame on you), the system property sun.arch.data.model has the value "32", "64", or "unknown".
您可以像 System.getProperty("sun.arch.data.model")
一样访问它。显然,该属性实际上只能在 Sun JVM/JRE 上设置。
您还可以尝试解析System.getProperty("java.vm.name")
的结果,但这也将是高度特定于 vendor 的。
关于java - 在32位浏览器中检测64位jre?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1160448/