你如何确定的Windows 32或64位架构使用Java?架构、Windows、Java

2023-09-07 18:04:39 作者:Warm light。(暖光)

你如何确定的Windows 32或64位架构使用Java?

How do you determine 32 or 64 bit architecture of Windows using Java?

感谢。

推荐答案

请注意, os.arch 属性只会给你的 JRE的体系结构的,而不是基本的操作系统。

Please note, the os.arch property will only give you the architecture of the JRE, not of the underlying os.

如果您在64位系统上安装32位JRE, System.getProperty(os.arch)返回 86

If you install a 32 bit jre on a 64 bit system, System.getProperty("os.arch") will return x86

为了实际确定的基本架构,您将需要编写一些本地code。请参阅this帖子更多信息(和一个链接品尝本地code)

In order to actually determine the underlying architecture, you will need to write some native code. See this post for more info (and a link to sample native code)