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

后端 未结 9 2190
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 03:02

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

9条回答
  •  天涯浪人
    2020-11-30 03:40

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

    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)

提交回复
热议问题