久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 Java 檢查操作系統的位數?(J2SE,不是

How can I check the bitness of my OS using Java? (J2SE, not os.arch)(如何使用 Java 檢查操作系統的位數?(J2SE,不是 os.arch))
本文介紹了如何使用 Java 檢查操作系統的位數?(J2SE,不是 os.arch)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在開發一個軟件應用程序來檢查您安裝了哪種軟件,但為了這樣做,我必須知道操作系統是 32 位還是 64 位操作系統.

I'm developing a software application that checks what kind of software you have installed, but in order to do so, I must know if the OS is a 32 bit or a 64 bit OS.

我試過 System.getProperty("os.arch");但后來我讀到這個命令只向我們展示了 JDK/JRE 的位數,而不是操作系統本身.如果您能告訴我如何知道正在使用的操作系統(Windows 7、Mac OS、Ubuntu 等),那就太棒了.

I tried System.getProperty("os.arch"); but then I read that this command only shows us the bitness of the JDK/JRE, not the OS itself. If you could tell me how to know which OS is being used (Windows 7, Mac OS, Ubuntu, etc...) that would be simply awesome.

推薦答案

System.getProperty("os.arch");

應該在所有平臺上都可用,請參閱 Java 系統屬性教程 了解更多信息.

Should be available on all platforms, see the Java System Properties Tutorial for more information.

但是如果是 32 位 JVM,64 位 Windows 平臺會欺騙 JVM.實際上,64 位 Windows 會欺騙任何 32 位進程的環境,以幫助舊的 32 位程序在 64 位操作系統上正常工作.閱讀 關于 WOW64 的 MSDN 文章更多信息.

But 64 bit Windows platforms will lie to the JVM if it is a 32 bit JVM. Actually 64 bit Windows will lie to any 32 bit process about the environment to help old 32 bit programs work properly on a 64 bit OS. Read the MSDN article about WOW64 for more information.

作為 WOW64 的結果,調用 System.getProperty("os.arch") 的 32 位 JVM 將返回x86".如果你想在Windows上獲得底層操作系統的真實架構,使用如下邏輯:

As a result of WOW64, a 32 bit JVM calling System.getProperty("os.arch") will return "x86". If you want to get the real architecture of the underlying OS on Windows, use the following logic:

String arch = System.getenv("PROCESSOR_ARCHITECTURE");
String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");

String realArch = arch != null && arch.endsWith("64")
                  || wow64Arch != null && wow64Arch.endsWith("64")
                      ? "64" : "32";

另見:

如何:檢測進程位數

為什么 %processor_architecture% 總是返回 x86 而不是 AMD64

檢測當前Windows版本是否為32位或 64 位

這篇關于如何使用 Java 檢查操作系統的位數?(J2SE,不是 os.arch)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 国产乱码久久久 | 精品真实国产乱文在线 | 日韩国产专区 | 国产精品亚洲成在人线 | 亚洲一区中文字幕 | av一级毛片| 欧美日韩综合一区 | 精品1区2区3区 | 精品久久一 | 国产视频日韩 | 久久精品久久久久久 | 亚洲a网| 在线免费观看a级片 | 狠狠亚洲| 欧美精品91 | 亚洲精品视频免费看 | 在线观看亚洲 | 国产精品视频一区二区三区 | 亚洲一区视频在线 | 国产毛片毛片 | 精品1区2区3区 | 亚洲久在线 | 日韩精品成人在线 | 久久精彩视频 | 午夜男人天堂 | 久久亚洲国产精品日日av夜夜 | 欧美美女二区 | 国产精品久久久久一区二区三区 | 9999精品视频| 色综合桃花网 | 久久久久久影院 | 中文一区 | 精品国产高清一区二区三区 | 欧美一级片在线播放 | 国产精品亚洲一区 | 国产一区精品在线 | 日韩欧美中文字幕在线观看 | 欧美在线视频一区二区 | 青久草视频 | 国产乱码精品一品二品 | 国产精品九九视频 |