Java确认电脑系统

走着路睡觉
  • java
小于 1 分钟

public static final class OsUtils
{
   private static String OS = null;
   public static String getOsName()
   {
      if(OS == null) { 
        OS = System.getProperty("os.name"); 
      }
      return OS;
   }
   public static boolean isWindows()
   {
      return getOsName().startsWith("Windows");
   }

   public static boolean isUnix() // and so on
}
上次编辑于:
贡献者: zhaojingbo
Loading...