//OBTENER EL OS DONDE SE EJCUTA EL CODIGO JAVA
String os = System.getProperty("os.name").toLowerCase();
//Validacion para win o linux
if (isWindows()) {
System.out.println("This is Windows");
} else if (isUnix()) {
System.out.println("This is Unix or Linux");
}
}
//Metodos
//windows
public static boolean isWindows() {
return (os.indexOf("win") >= 0);
}
//Linux
public static boolean isLinux() {
return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
}