您如何使用 Java 确定 Windows 的 32 位或 64 位体系结构? [英] How do you determine 32 or 64 bit architecture of Windows using Java?

查看:38
本文介绍了您如何使用 Java 确定 Windows 的 32 位或 64 位体系结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何确定使用 Java 的 Windows 是 32 位还是 64 位架构?

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") 将返回 x86

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

为了真正确定底层架构,您需要编写一些本机代码.参见 这篇文章了解更多信息(以及示例本机代码的链接)

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)

这篇关于您如何使用 Java 确定 Windows 的 32 位或 64 位体系结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆