I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different propertie
A small example of what you're trying to achieve would probably be a class
similar to what's underneath:
import java.util.Locale;
public class OperatingSystem
{
private static String OS = System.getProperty("os.name", "unknown").toLowerCase(Locale.ROOT);
public static boolean isWindows()
{
return OS.contains("win");
}
public static boolean isMac()
{
return OS.contains("mac");
}
public static boolean isUnix()
{
return OS.contains("nux");
}
}
This particular implementation is quite reliable and should be universally applicable. Just copy and paste it into your class
of choice.