使用Java类System可以获取到大多数系统信息,因此本次判断运行操作系统是否是windows也可以从System类入手。
具体方法:
public boolean isWindows() {
return System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1;
}
使用Java类System可以获取到大多数系统信息,因此本次判断运行操作系统是否是windows也可以从System类入手。
具体方法:
public boolean isWindows() {
return System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1;
}