Detect operating system in java

class TestJava {
 
	public static void main(String[] args) {
		String operatingSystem = System.getProperty("os.name").toLowerCase();
		if (operatingSystem.contains("win")){
			System.out.println("Operating system is Windows");	
		}
		else if (operatingSystem.contains("osx")){
			System.out.println("Operating system is OSX");	
		}      
		else if (operatingSystem.contains("nix")){
			System.out.println("Operating system is NIX");	
		}
		else if (operatingSystem.contains("nux")){
			System.out.println("Operating system is NUX");	
		}
		else if (operatingSystem.contains("aix")){
			System.out.println("Operating system is *AIX");	
		}
 
	}
}

Output:

Operating system is Windows
Content Protection by DMCA.com
Please Share