1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.commons.util;
21
22 /***
23 * Provides static variables that describe properties of the underlying
24 * platform and runtime environment. Sometimes it is necessary to work
25 * around certain differences between platforms or bugs of a specific JDK
26 * release.
27 *
28 * @author Steffen Pingel
29 */
30 public class SystemHelper {
31
32 /***
33 * True, if is system is Apple Mac OS X; false, otherwise.
34 */
35 public static final boolean IS_MACOSX;
36
37 /***
38 * True, if system is Microsoft Windows; false, otherwise.
39 */
40 public static final boolean IS_WINDOWS;
41
42 /***
43 * True, if system is Microsoft Windows XP; false, otherwise.
44 */
45 public static final boolean IS_WINDOWS_XP;
46
47 /***
48 * True, if Java version is higher or equal than 1.6.0.
49 */
50 public static final boolean IS_JAVA6_OR_HIGHER;
51
52 static {
53 String ver = System.getProperty("java.version", "");
54 IS_JAVA6_OR_HIGHER = (VersionParser.compare(ver, "1.6") >= 0);
55
56 String os = System.getProperty("os.name").toLowerCase();
57 IS_WINDOWS = (os.indexOf("windows") != -1);
58 IS_WINDOWS_XP = IS_WINDOWS && (os.indexOf("xp") != -1);
59 IS_MACOSX = (os.indexOf("mac os x") != -1);
60 }
61
62 }