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 }

Read more of this post