java 如何判断操作系统的类型

我现在有一段代码跟操作系统的类型有关,需要跟操作系统的类型做出不同的响应。
我现在有一段代码跟操作系统的类型有关,需要根据操作系统的类型做出不同的响应。

第1个回答  推荐于2016-09-16
Properties prop = System.getProperties();

String os = prop.getProperty("os.name");
System.out.println(os);

os.startWith("win") || os.startWith("Win") == windows操作系统本回答被提问者采纳
第2个回答  2011-11-04
这个简单 获取系统名字 System.getProperty("os.name"));
System.out.println(System.getProperty("os.name"));
第3个回答  2011-11-04
Properties prop = System.getProperties();

String os = prop.getProperty("os.name");
System.out.println(os);

os.startWith("win") || os.startWith("Win") == windows操作系统

这个是 正解

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网