我现在有一段代码跟操作系统的类型有关,需要跟操作系统的类型做出不同的响应。
我现在有一段代码跟操作系统的类型有关,需要根据操作系统的类型做出不同的响应。
第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操作系统本回答被提问者采纳
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"));
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操作系统
这个是 正解
String os = prop.getProperty("os.name");
System.out.println(os);
os.startWith("win") || os.startWith("Win") == windows操作系统
这个是 正解