Answers for "how to detect operating system in java"

1

how to detect operating system in java

String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")){
    //Operating system is based on Windows
}
else if (os.contains("osx")){
    //Operating system is Apple OSX based
}      
else if (os.contains("nix") || os.contains("aix") || os.contains("nux")){
    //Operating system is based on Linux/Unix/*AIX
}
Posted by: Guest on May-05-2021

Code answers related to "how to detect operating system in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language