Java有提供的类可以实现判断当前运行系统的类别
String osName = System.getProperty("os.name");
if(osName.startsWith("Windows")) {
System.out.println("已检测到您当前使用的系统为:WIN");
} else if(osName.startsWith("Linux")) {
System.err.println("已检测到您当前使用的系统为:Linux");
}
Java有提供的类可以实现判断当前运行系统的类别
String osName = System.getProperty("os.name");
if(osName.startsWith("Windows")) {
System.out.println("已检测到您当前使用的系统为:WIN");
} else if(osName.startsWith("Linux")) {
System.err.println("已检测到您当前使用的系统为:Linux");
}