01: /*
02: * MCS Media Computer Software Copyright (c) 2005 by MCS
03: * -------------------------------------- Created on 16.01.2004 by w.klaas
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License. You may obtain a copy of
07: * the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14: * License for the specific language governing permissions and limitations under
15: * the License.
16: */
17: package de.mcs.utils;
18:
19: /**
20: * Hetting informations about the underrlying OS.
21: *
22: * @author w.klaas
23: *
24: */
25: public final class OSInformations {
26:
27: /** prevent instancing. */
28: private OSInformations() {
29:
30: }
31:
32: /** the OS version. */
33: private static String myOSVersion = System.getProperty("os.name");
34:
35: /** the framework runs on windows. */
36: private static boolean bWin32 = false;
37: static {
38: bWin32 = (System.getProperty("os.name").toUpperCase()
39: .startsWith("WINDOWS"));
40: }
41:
42: /** the framework runs on MAC OS X. */
43: private static boolean bMACOSX = false;
44: static {
45: bMACOSX = (System.getProperty("os.name").toUpperCase()
46: .substring(0, 3).equals("MAC"));
47: }
48:
49: /**
50: * checking the underlying OS.
51: *
52: * @param args
53: * not used.
54: */
55: public static void main(final String[] args) {
56: System.out.print("Win32:");
57: System.out.println(bWin32);
58: System.out.print("MacOSX:");
59: System.out.println(bMACOSX);
60: }
61:
62: /**
63: * @return is this vm running on MACOSX
64: */
65: public static boolean isMACOSX() {
66: return bMACOSX;
67: }
68:
69: /**
70: * @return is this vm running on MACOSX
71: */
72: public static boolean isWin32() {
73: return bWin32;
74: }
75:
76: /**
77: * @return getting the OS version string.
78: */
79: public static String getOSVersion() {
80: return myOSVersion;
81: }
82: }
|