String os = System.getProperty("os.name").toLowerCase(); if(os.indexOf("win") >= 0) { System.out.println("Windows"); }else if(os.indexOf("nix") >=0 || os.indexOf("nux") >=0 || os.indexOf("aix") >0) { System.out.println("Unix"); }else if(os.indexOf("mac") >= 0) { System.out.println("Mac"); }