how to detect operating system in java

Solutions on MaxInterview for how to detect operating system in java by the best coders in the world

showing results for - "how to detect operating system in java"
Frida
06 Jan 2019
1String os = System.getProperty("os.name").toLowerCase();
2if (os.contains("win")){
3    //Operating system is based on Windows
4}
5else if (os.contains("osx")){
6    //Operating system is Apple OSX based
7}      
8else if (os.contains("nix") || os.contains("aix") || os.contains("nux")){
9    //Operating system is based on Linux/Unix/*AIX
10}