Java 识别当前操作系统

2022-02-28 22:07:40
``` public boolean isWindows() { return System.getProperty("os.name").toLowerCase().contains("windows"); } public boolean isMac() { return System.getProperty("os.name").toLowerCase().contains("mac"); } public boolean isLinux() { return System.getProperty("os.name").toLowerCase().contains("linux"); } ```