package com.eactive.ext.kjb.utils; import java.net.InetAddress; public class OsUtil { public static boolean isWindows() { return System.getProperty("os.name").toLowerCase().contains("win"); } public static boolean isLinux() { String os = System.getProperty("os.name").toLowerCase(); return os.contains("nux") || os.contains("nix") || os.contains("aix") ; } public static String getHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { String name = System.getProperty("COMPUTERNAME"); if (name == null) name = System.getenv("HOSTNAME"); return name != null ? name : "unknown"; } } }