Package com.helger.commons.system
Class SystemProperties
java.lang.Object
com.helger.commons.system.SystemProperties
- All Implemented Interfaces:
IHasConditionalLogger
This class wraps all the Java system properties like version number etc.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClear the cache with the property names, for which warnings were emitted that keys don't exist.static booleancontainsPropertyName(String sPropertyName) Check if a system property with the given name exists.static String[]Get a set of system property names which are relevant for network debugging/proxy handling.static ICommonsMap<String, String> static ICommonsSet<String> static ICommonsSet<String> static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic StringgetPropertyValue(String sKey) static StringgetPropertyValueOrNull(String sKey) static Stringstatic Stringstatic Stringstatic Stringstatic booleanstatic StringremovePropertyValue(String sKey) Remove a system property value under consideration of an eventually presentSecurityManager.static EChangesetPropertyValue(String sKey, boolean bValue) Set a system property value under consideration of an eventually presentSecurityManager.static EChangesetPropertyValue(String sKey, int nValue) Set a system property value under consideration of an eventually presentSecurityManager.static EChangesetPropertyValue(String sKey, long nValue) Set a system property value under consideration of an eventually presentSecurityManager.static EChangesetPropertyValue(String sKey, String sValue) Set a system property value under consideration of an eventually presentSecurityManager.static booleansetSilentMode(boolean bSilentMode) Enable or disable certain regular log messages.
-
Field Details
-
SYSTEM_PROPERTY_FILE_SEPARATOR
- See Also:
-
SYSTEM_PROPERTY_JAVA_CLASS_PATH
- See Also:
-
SYSTEM_PROPERTY_JAVA_CLASS_VERSION
- See Also:
-
SYSTEM_PROPERTY_JAVA_LIBRARY_PATH
- See Also:
-
SYSTEM_PROPERTY_JAVA_HOME
- See Also:
-
SYSTEM_PROPERTY_JAVA_IO_TMPDIR
- See Also:
-
SYSTEM_PROPERTY_JAVA_RUNTIME_NAME
- See Also:
-
SYSTEM_PROPERTY_JAVA_RUNTIME_VERSION
- See Also:
-
SYSTEM_PROPERTY_JAVA_SPECIFICATION_URL
- See Also:
-
SYSTEM_PROPERTY_JAVA_SPECIFICATION_VENDOR
- See Also:
-
SYSTEM_PROPERTY_JAVA_SPECIFICATION_VERSION
- See Also:
-
SYSTEM_PROPERTY_JAVA_VENDOR
- See Also:
-
SYSTEM_PROPERTY_JAVA_VENDOR_URL
- See Also:
-
SYSTEM_PROPERTY_JAVA_VERSION
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_NAME
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_SPECIFICATION_URL
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_SPECIFICATION_VENDOR
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_SPECIFICATION_VERSION
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_URL
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_VENDOR
- See Also:
-
SYSTEM_PROPERTY_JAVA_VM_VERSION
- See Also:
-
SYSTEM_PROPERTY_LINE_SEPARATOR
- See Also:
-
SYSTEM_PROPERTY_OS_ARCH
- See Also:
-
SYSTEM_PROPERTY_OS_NAME
- See Also:
-
SYSTEM_PROPERTY_OS_VERSION
- See Also:
-
SYSTEM_PROPERTY_PATH_SEPARATOR
- See Also:
-
SYSTEM_PROPERTY_USER_DIR
- See Also:
-
SYSTEM_PROPERTY_USER_HOME
- See Also:
-
SYSTEM_PROPERTY_USER_NAME
- See Also:
-
SYSTEM_PROPERTY_SUN_IO_SERIALIZATION_EXTENDEDDEBUGINFO
- See Also:
-
-
Method Details
-
isSilentMode
public static boolean isSilentMode()- Returns:
trueif logging is disabled,falseif it is enabled.
-
setSilentMode
public static boolean setSilentMode(boolean bSilentMode) Enable or disable certain regular log messages.- Parameters:
bSilentMode-trueto disable logging,falseto enable logging- Returns:
- The previous value of the silent mode.
-
getPropertyValueOrNull
-
getPropertyValue
-
clearWarnedPropertyNames
public static void clearWarnedPropertyNames()Clear the cache with the property names, for which warnings were emitted that keys don't exist. -
getAllWarnedPropertyNames
- Returns:
- A copy of the set with all property names for which warnings were emitted.
-
setPropertyValue
Set a system property value under consideration of an eventually presentSecurityManager.- Parameters:
sKey- The key of the system property. May not benull.bValue- The value of the system property.- Returns:
EChange
-
setPropertyValue
Set a system property value under consideration of an eventually presentSecurityManager.- Parameters:
sKey- The key of the system property. May not benull.nValue- The value of the system property.- Returns:
EChange- Since:
- 8.5.7
-
setPropertyValue
Set a system property value under consideration of an eventually presentSecurityManager.- Parameters:
sKey- The key of the system property. May not benull.nValue- The value of the system property.- Returns:
EChange- Since:
- 8.5.7
-
setPropertyValue
Set a system property value under consideration of an eventually presentSecurityManager.- Parameters:
sKey- The key of the system property. May not benull.sValue- The value of the system property. If the value isnullthe property is removed.- Returns:
EChange
-
removePropertyValue
Remove a system property value under consideration of an eventually presentSecurityManager.- Parameters:
sKey- The key of the system property to be removed. May not benull.- Returns:
- the previous string value of the system property, or
nullif there was no property with that key.
-
getJavaVersion
- Returns:
- System property value
java.version
-
getJavaVendor
- Returns:
- System property value
java.vendor
-
getJavaVendorURL
- Returns:
- System property value
java.vendor.url
-
getJavaHome
- Returns:
- System property value
java.home
-
getJavaClassVersion
- Returns:
- System property value
java.class.version
-
getJavaClassPath
- Returns:
- System property value
java.class.path
-
getJavaLibraryPath
- Returns:
- System property value
java.library.path
-
getOsName
- Returns:
- System property value
os.name
-
getOsArch
- Returns:
- System property value
os.arch
-
getOsVersion
- Returns:
- System property value
os.version
-
getFileSeparator
- Returns:
- System property value
file.separator
-
getPathSeparator
- Returns:
- System property value
path.separator
-
getLineSeparator
- Returns:
- System property value
line.separator
-
getUserName
- Returns:
- System property value
user.name
-
getUserHome
- Returns:
- System property value
user.home
-
getUserDir
- Returns:
- System property value
user.dir
-
getJavaVmName
- Returns:
- System property value
java.vm.name
-
getJavaVmSpecificationVersion
- Returns:
- System property value
java.vm.specification.version
-
getJavaVmSpecificationVendor
- Returns:
- System property value
java.vm.specification.vendor
-
getJavaVmSpecificationUrl
- Returns:
- System property value
java.vm.specification.url
-
getJavaVmVersion
- Returns:
- System property value
java.vm.version
-
getJavaVmVendor
- Returns:
- System property value
java.vm.vendor
-
getJavaVmUrl
- Returns:
- System property value
java.vm.url
-
getJavaSpecificationVersion
- Returns:
- System property value
java.specification.version
-
getJavaSpecificationVendor
- Returns:
- System property value
java.specification.vendor
-
getJavaSpecificationUrl
- Returns:
- System property value
java.specification.url
-
getTmpDir
@DevelopersNote("This property is not part of the language but part of the Sun SDK") @Nullable public static String getTmpDir()- Returns:
- System property value
java.io.tmpdir
-
getJavaRuntimeVersion
- Returns:
- System property value
java.runtime.version
-
getJavaRuntimeName
- Returns:
- System property value
java.runtime.version
-
getAllPropertyNames
- Returns:
- A set with all defined property names. Never
null.
-
getAllProperties
- Returns:
- A map with all system properties where the key is the system property name and the value is the system property value.
-
containsPropertyName
Check if a system property with the given name exists.- Parameters:
sPropertyName- The name of the property.- Returns:
trueif such a system property is present,falseotherwise
-
getAllJavaNetSystemProperties
Get a set of system property names which are relevant for network debugging/proxy handling. This method is meant to be used for reading the appropriate settings from a configuration file.- Returns:
- An array with all system property names which are relevant for
debugging/proxy handling. Never
nulland never empty. Each call returns a new array.
-