Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Detect which type of operating system (OS) you are using now. <br /> <br />
- * <i>
- * Source: http://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/ <br /> <br />
- * Modified by: Erieze Lagera <br />
- * </i>
- * @author Mkyong
- */
- public class OSValidator {
- private static final String OS = System.getProperty("os.name").toLowerCase();
- public static boolean isWindows() {
- return (OS.contains("win"));
- }
- public static boolean isMac() {
- return (OS.contains("mac"));
- }
- public static boolean isUnix() {
- return (OS.contains("nix") || OS.contains("nux") || OS.indexOf("aix") > 0 );
- }
- public static boolean isSolaris() {
- return (OS.contains("sunos"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment