Java判断当前是win/linux...系统
public static void main(String[] args) {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
System.out.println("win");
} else if (os.contains("mac")) {
System.out.println("mac");
} else if (os.contains("linux")) {
System.out.println("linux");
} else {
throw new UnsupportedOperationException("Unsupported operating system: " + os);
}
}
浙公网安备 33010602011771号