Java tutorial
//package com.java2s; public class Main { public static final int OS_WINDOWS = 0; public static final int OS_MACINTOSH = 1; public static final int OS_OTHER = 2; /** * Are we running on Mac OS 10.4.x ? * * @return true or false */ public static boolean isMacOS_10_4() { boolean rval = false; if (isMacintosh()) { String osVersion = System.getProperty("os.version"); if (osVersion != null) { rval = osVersion.startsWith("10.4"); } } return rval; } /** * Determines whether we're running on a Macintosh. * * @return true or false */ public static boolean isMacintosh() { return getOperatingSystem() == OS_MACINTOSH; } /** * Gets the operating system type. * * @return OS_WINDOWS, OS_MACINTOSH, or OS_OTHER */ public static int getOperatingSystem() { // Get the operating system name. String osName = ""; try { osName = System.getProperty("os.name"); } catch (Throwable t) { t.printStackTrace(); } // Convert to one of the operating system constants. int os = OS_OTHER; if (osName.toLowerCase().indexOf("windows") >= 0) { os = OS_WINDOWS; } else if (osName.startsWith("Mac OS X")) { os = OS_MACINTOSH; } return os; } }