Java有提供的类可以实现判断当前运行系统的类别
String osName = System.getProperty("os.name"); if(osName.startsWith("Windows")) { System.out.println("已检测到您当前使用的系统为:WIN"); } else if(osName.startsWith("Linux")) { System.err.println("已检测到您当前使用的系统为:Linux"); }
因篇幅问题不能全部显示,请点此查看更多更全内容