在Java中可能重複:
How do I programmatically determine operating system in Java?如何獲得計算機運行java的操作系統?
,我怎麼什麼操作系統類型(在Mac,Windows,Linux等),我的Java小程序正在運行中?
預先感謝; d
在Java中可能重複:
How do I programmatically determine operating system in Java?如何獲得計算機運行java的操作系統?
,我怎麼什麼操作系統類型(在Mac,Windows,Linux等),我的Java小程序正在運行中?
預先感謝; d
public class OpertingSystemInfo
{
public static void main(String[] args)
{
String nameOS = "os.name";
String versionOS = "os.version";
String architectureOS = "os.arch";
System.out.println("\n The information about OS");
System.out.println("\nName of the OS: " + System.getProperty(nameOS));
System.out.println("Version of the OS: " + System.getProperty(versionOS));
System.out.println("Architecture of THe OS: " + System.getProperty(architectureOS));
}
}
謝謝!一個很好的答案:D – Hoolean
系統屬性os.name
提供操作系統的名稱。
System.out.println(System.getProperties().get("os.name"));
-1;你應該問你最喜歡的搜索引擎... – home