OSValidator.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.data.util;
00002
00003
00004
00005
00006
00007
00008 public class OSValidator {
00009
00010 static private final String os = OSValidator.getOS();
00011 static private final boolean mac = ( os.indexOf("mac") >= 0 );
00012 static private final boolean win = ( os.indexOf("win") >= 0 );
00013 static private final boolean unix = ( os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0 );
00014
00015
00016
00017
00018
00019 public static void main(String[] args)
00020 {
00021 if(isWindows()){
00022 System.out.println("This is Windows");
00023 }else if(isMac()){
00024 System.out.println("This is Mac");
00025 }else if(isUnix()){
00026 System.out.println("This is Unix or Linux");
00027 }else{
00028 System.out.println("Your OS is not supported!!");
00029 }
00030 }
00031
00032
00033
00034
00035
00036 public static boolean isWindows(){
00037 return win;
00038 }
00039
00040
00041
00042
00043
00044 public static boolean isMac(){
00045 return mac;
00046 }
00047
00048
00049
00050
00051
00052 public static boolean isUnix(){
00053 return unix;
00054 }
00055
00056
00057 private static String getOS() {
00058 return System.getProperty("os.name").toLowerCase();
00059 }
00060 }