Java examples for Native OS:OS
get Os Type From Os
import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; public class Main{ public static String getOsTypeFromOs(String system) { if (StringUtil.isEmpty(system)) return null; if (system.toLowerCase().startsWith("windows")) return "windows"; else if (system.toLowerCase().startsWith("linux")) return "linux"; else if (system.toLowerCase().startsWith("mac")) return "mac"; else if (system.toLowerCase().startsWith("sunos")) return "sunos"; else if (system.toLowerCase().startsWith("iphone os")) return "iphone os"; else if (system.toLowerCase().startsWith("android")) return "android"; return null; }//w ww.java2 s . co m }