com.jgoodies.common.base
Class SystemUtils

java.lang.Object
  extended by com.jgoodies.common.base.SystemUtils

public class SystemUtils
extends java.lang.Object

Provides convenience behavior to determine the operating system and Java version.

Version:
$Revision: 1.9 $
Author:
Karsten Lentzsch

Field Summary
static boolean HAS_MODERN_RASTERIZER
          True since Java 6 update 10.
static boolean IS_JAVA_5
          True if this is Java 5.x.
static boolean IS_JAVA_6
          True if this is Java 6.
static boolean IS_JAVA_6_OR_LATER
          True if this is Java 6.x or later.
static boolean IS_JAVA_7
          True if this is Java 7.
static boolean IS_JAVA_7_OR_LATER
          True if this is Java 6.x or later.
static boolean IS_LAF_WINDOWS_XP_ENABLED
          True if the Windows XP Look&Feel is enabled.
static boolean IS_LOW_RESOLUTION
          Is true if this environment's default toolkit reports a screen resolution below 120 dpi.
static boolean IS_OS_LINUX
          Is true if this is Linux.
static boolean IS_OS_MAC
          True if this is the Mac OS.
static boolean IS_OS_SOLARIS
          True if this is Solaris.
static boolean IS_OS_WINDOWS
          True if this is Windows.
static boolean IS_OS_WINDOWS_2000
          True if this is Windows 2000.
static boolean IS_OS_WINDOWS_6_OR_LATER
          True if this is Windows Vista/Server 2008/7/2008 R2.
static boolean IS_OS_WINDOWS_98
          True if this is Windows 98.
static boolean IS_OS_WINDOWS_ME
          True if this is Windows ME.
static boolean IS_OS_WINDOWS_VISTA
          True if this is Windows Vista or Server 2008.
static boolean IS_OS_WINDOWS_XP
          True if this is Windows XP.
protected static java.lang.String JAVA_VERSION
          The os.name System Property.
protected static java.lang.String OS_NAME
          The os.name System Property.
protected static java.lang.String OS_VERSION
          The os.version System Property.
 
Constructor Summary
protected SystemUtils()
           
 
Method Summary
protected static java.lang.String getSystemProperty(java.lang.String key)
          Tries to look up the System property for the given key.
protected static boolean startsWith(java.lang.String str, java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OS_NAME

protected static final java.lang.String OS_NAME
The os.name System Property. Operating system name.

Defaults to null, if the runtime does not have security access to read this property or the property does not exist.


OS_VERSION

protected static final java.lang.String OS_VERSION
The os.version System Property. Operating system version.

Defaults to null, if the runtime does not have security access to read this property or the property does not exist.


JAVA_VERSION

protected static final java.lang.String JAVA_VERSION
The os.name System Property. Operating system name.

Defaults to null, if the runtime does not have security access to read this property or the property does not exist.


IS_OS_LINUX

public static final boolean IS_OS_LINUX
Is true if this is Linux.


IS_OS_MAC

public static final boolean IS_OS_MAC
True if this is the Mac OS.


IS_OS_SOLARIS

public static final boolean IS_OS_SOLARIS
True if this is Solaris.


IS_OS_WINDOWS

public static final boolean IS_OS_WINDOWS
True if this is Windows.


IS_OS_WINDOWS_98

public static final boolean IS_OS_WINDOWS_98
True if this is Windows 98.


IS_OS_WINDOWS_ME

public static final boolean IS_OS_WINDOWS_ME
True if this is Windows ME.


IS_OS_WINDOWS_2000

public static final boolean IS_OS_WINDOWS_2000
True if this is Windows 2000.


IS_OS_WINDOWS_XP

public static final boolean IS_OS_WINDOWS_XP
True if this is Windows XP.


IS_OS_WINDOWS_VISTA

public static final boolean IS_OS_WINDOWS_VISTA
True if this is Windows Vista or Server 2008.


IS_OS_WINDOWS_6_OR_LATER

public static final boolean IS_OS_WINDOWS_6_OR_LATER
True if this is Windows Vista/Server 2008/7/2008 R2.


IS_JAVA_5

public static final boolean IS_JAVA_5
True if this is Java 5.x. We check for a prefix of 1.5.


IS_JAVA_6

public static final boolean IS_JAVA_6
True if this is Java 6. We check for a prefix of 1.6.


IS_JAVA_6_OR_LATER

public static final boolean IS_JAVA_6_OR_LATER
True if this is Java 6.x or later. We check that it's neither 1.4 nor 1.5.


IS_JAVA_7

public static final boolean IS_JAVA_7
True if this is Java 7. We check for a prefix of 1.7.


IS_JAVA_7_OR_LATER

public static final boolean IS_JAVA_7_OR_LATER
True if this is Java 6.x or later. We check that it's neither 1.4 nor 1.5 nor 1.6.


HAS_MODERN_RASTERIZER

public static final boolean HAS_MODERN_RASTERIZER
True since Java 6 update 10.

Since:
1.2

IS_LAF_WINDOWS_XP_ENABLED

public static final boolean IS_LAF_WINDOWS_XP_ENABLED
True if the Windows XP Look&Feel is enabled.

Since:
1.2

IS_LOW_RESOLUTION

public static final boolean IS_LOW_RESOLUTION
Is true if this environment's default toolkit reports a screen resolution below 120 dpi.

Since:
1.2
Constructor Detail

SystemUtils

protected SystemUtils()
Method Detail

getSystemProperty

protected static java.lang.String getSystemProperty(java.lang.String key)
Tries to look up the System property for the given key. In untrusted environments this may throw a SecurityException. In this case we catch the exception and answer an empty string.

Parameters:
key - the name of the system property
Returns:
the system property's String value, or null if there's no such value, or an empty String when a SecurityException has been caught

startsWith

protected static boolean startsWith(java.lang.String str,
                                    java.lang.String prefix)


Copyright © 2009-2011 JGoodies Karsten Lentzsch. All Rights Reserved.