System.getProperty

System.getProperty

Class Overview | Class Members | This Package | All Packages

Syntax 1
public static String getProperty( String key )
Parameters
key
the name of the system property.
Returns
the string value of the system property, or null if there is no property with that key.
Description
Gets the system property indicated by the specified key.

First, if there is a security manager, its checkPropertyAccess method is called with the key as its argument. This may result in a system exception.

If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the getProperties method.

Exceptions
SecurityException if the current thread cannot access the system properties or the specified property.
See Also
SecurityException, checkPropertyAccess, getProperties



Syntax 2
public static String getProperty( String key, String def )
Parameters
key
the name of the system property.
def
a default value.
Returns
the string value of the system property, or the default value if there is no property with that key.
Description
Gets the system property indicated by the specified key.

First, if there is a security manager, its checkPropertyAccess method is called with the key as its argument.

If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the getProperties method.

Exceptions
SecurityException if the current thread cannot access the system properties or the specified property.
See Also
checkPropertyAccess, getProperties