Class SystemUtils
- java.lang.Object
-
- io.microsphere.util.BaseUtils
-
- io.microsphere.util.SystemUtils
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FILE_ENCODING
The System property for the file encoding, the default is "UTF-8"static java.lang.String
FILE_ENCODING_PROPERTY_KEY
The System property key for the file encodingstatic java.lang.String
FILE_SEPARATOR_PROPERTY_KEY
The System property key for the File separator ("/" on UNIX).static boolean
IS_JAVA_10
Istrue
if this is Java version 10.xstatic boolean
IS_JAVA_11
Istrue
if this is Java version 11.xstatic boolean
IS_JAVA_12
Istrue
if this is Java version 12.xstatic boolean
IS_JAVA_13
Istrue
if this is Java version 13.xstatic boolean
IS_JAVA_14
Istrue
if this is Java version 14.xstatic boolean
IS_JAVA_15
Istrue
if this is Java version 15.xstatic boolean
IS_JAVA_16
Istrue
if this is Java version 16.xstatic boolean
IS_JAVA_17
Istrue
if this is Java version 17.xstatic boolean
IS_JAVA_18
Istrue
if this is Java version 18.xstatic boolean
IS_JAVA_19
Istrue
if this is Java version 19.xstatic boolean
IS_JAVA_20
Istrue
if this is Java version 20.xstatic boolean
IS_JAVA_21
Istrue
if this is Java version 21.xstatic boolean
IS_JAVA_22
Istrue
if this is Java version 22.xstatic boolean
IS_JAVA_8
Istrue
if this is Java 8static boolean
IS_JAVA_9
Istrue
if this is Java version 9.xstatic boolean
IS_LTS_JAVA_VERSION
Istrue
if current Java version is Long Term Supported(LTS)static boolean
IS_OS_WINDOWS
Istrue
if this is Windows.static java.lang.String
JAVA_CLASS_PATH
The System property for the Java class path.static java.lang.String
JAVA_CLASS_PATH_PROPERTY_KEY
The System property key for the Java class path.static java.lang.String
JAVA_CLASS_VERSION
The System property for the Java class format version number.static java.lang.String
JAVA_CLASS_VERSION_PROPERTY_KEY
The System property key for the Java class format version number.static java.lang.String
JAVA_COMPILER
The System property for the Name of JIT compiler to use.static java.lang.String
JAVA_COMPILER_PROPERTY_KEY
The System property key for the Name of JIT compiler to use.static java.lang.String
JAVA_EXT_DIRS
The System property for the Path of extension directory or directories Deprecated.static java.lang.String
JAVA_EXT_DIRS_PROPERTY_KEY
The System property key for the Path of extension directory or directories Deprecated.static java.lang.String
JAVA_HOME
The System property for the Java installation directory.static java.lang.String
JAVA_HOME_PROPERTY_KEY
The System property key for the Java installation directory.static java.lang.String
JAVA_IO_TMPDIR
The System property for the Default temp file path.static java.lang.String
JAVA_IO_TMPDIR_PROPERTY_KEY
The System property key for the Default temp file path.static java.lang.String
JAVA_LIBRARY_PATH
The System property for the List of paths to search when loading libraries.static java.lang.String
JAVA_LIBRARY_PATH_PROPERTY_KEY
The System property key for the List of paths to search when loading libraries.static java.lang.String
JAVA_SPECIFICATION_NAME
The System property for the Java Runtime Environment specification name.static java.lang.String
JAVA_SPECIFICATION_NAME_PROPERTY_KEY
The System property key for the Java Runtime Environment specification name.static java.lang.String
JAVA_SPECIFICATION_VENDOR
The System property for the Java Runtime Environment specification vendor.static java.lang.String
JAVA_SPECIFICATION_VENDOR_PROPERTY_KEY
The System property key for the Java Runtime Environment specification vendor.static java.lang.String
JAVA_SPECIFICATION_VERSION
The System property for the Java Runtime Environment specification version.static java.lang.String
JAVA_SPECIFICATION_VERSION_PROPERTY_KEY
The System property key for the Java Runtime Environment specification version.static java.lang.String
JAVA_VENDOR
The System property for the Java Runtime Environment vendor.static java.lang.String
JAVA_VENDOR_PROPERTY_KEY
The System property key for the Java Runtime Environment vendor.static java.lang.String
JAVA_VENDOR_URL
The System property for the Java vendor URL.static java.lang.String
JAVA_VENDOR_URL_PROPERTY_KEY
The System property key for the Java vendor URL.static java.lang.String
JAVA_VERSION
The System property for the Java Runtime Environment version.static java.lang.String
JAVA_VERSION_PROPERTY_KEY
The System property key for the Java Runtime Environment version.static java.lang.String
JAVA_VM_NAME
The System property for the Java Virtual Machine implementation name.static java.lang.String
JAVA_VM_NAME_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation name.static java.lang.String
JAVA_VM_SPECIFICATION_NAME
The System property for the Java Virtual Machine specification name.static java.lang.String
JAVA_VM_SPECIFICATION_NAME_PROPERTY_KEY
The System property key for the Java Virtual Machine specification name.static java.lang.String
JAVA_VM_SPECIFICATION_VENDOR
The System property for the Java Virtual Machine specification vendor.static java.lang.String
JAVA_VM_SPECIFICATION_VENDOR_PROPERTY_KEY
The System property key for the Java Virtual Machine specification vendor.static java.lang.String
JAVA_VM_SPECIFICATION_VERSION
The System property for the Java Virtual Machine specification version.static java.lang.String
JAVA_VM_SPECIFICATION_VERSION_PROPERTY_KEY
The System property key for the Java Virtual Machine specification version.static java.lang.String
JAVA_VM_VENDOR
The System property for the Java Virtual Machine implementation vendor.static java.lang.String
JAVA_VM_VENDOR_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation vendor.static java.lang.String
JAVA_VM_VERSION
The System property for the Java Virtual Machine implementation version.static java.lang.String
JAVA_VM_VERSION_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation version.static java.lang.String
LINE_SEPARATOR_PROPERTY_KEY
The System property key for the Line separator ("\n" on UNIX).static java.lang.String
OS_ARCH
The System property for the Operating system architecture.static java.lang.String
OS_ARCH_PROPERTY_KEY
The System property key for the Operating system architecture.static java.lang.String
OS_NAME
The System property for the Operating system name.static java.lang.String
OS_NAME_PROPERTY_KEY
The System property key for the Operating system name.static java.lang.String
OS_NAME_WINDOWS_PREFIX
static java.lang.String
OS_VERSION
The System property for the Operating system version.static java.lang.String
OS_VERSION_PROPERTY_KEY
The System property key for the Operating system version.static java.lang.String
PATH_SEPARATOR_PROPERTY_KEY
The System property key for the Path separator (":" on UNIX).static java.lang.String
USER_DIR
The System property for the User's current working directory.static java.lang.String
USER_DIR_PROPERTY_KEY
The System property key for the User's current working directory.static java.lang.String
USER_HOME
The System property for the User's home directory.static java.lang.String
USER_HOME_PROPERTY_KEY
The System property key for the User's home directory.static java.lang.String
USER_NAME
The System property for the User's account name.static java.lang.String
USER_NAME_PROPERTY_KEY
The System property key for the User's account name.
-
Constructor Summary
Constructors Constructor Description SystemUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getSystemProperty(java.lang.String key)
Gets a System property, defaulting tonull
if the property cannot be read.static java.lang.String
getSystemProperty(java.lang.String key, java.lang.String defaultValue)
Gets a System property,defaultValue
if the property cannot be read.
-
-
-
Field Detail
-
OS_NAME_WINDOWS_PREFIX
public static final java.lang.String OS_NAME_WINDOWS_PREFIX
- See Also:
- Constant Field Values
-
JAVA_CLASS_PATH_PROPERTY_KEY
public static final java.lang.String JAVA_CLASS_PATH_PROPERTY_KEY
The System property key for the Java class path.- See Also:
- Constant Field Values
-
USER_NAME_PROPERTY_KEY
public static final java.lang.String USER_NAME_PROPERTY_KEY
The System property key for the User's account name.- See Also:
- Constant Field Values
-
JAVA_EXT_DIRS_PROPERTY_KEY
public static final java.lang.String JAVA_EXT_DIRS_PROPERTY_KEY
The System property key for the Path of extension directory or directories Deprecated. This property, and the mechanism which implements it, may be removed in a future release..- See Also:
- Constant Field Values
-
JAVA_VENDOR_PROPERTY_KEY
public static final java.lang.String JAVA_VENDOR_PROPERTY_KEY
The System property key for the Java Runtime Environment vendor.- See Also:
- Constant Field Values
-
JAVA_SPECIFICATION_VERSION_PROPERTY_KEY
public static final java.lang.String JAVA_SPECIFICATION_VERSION_PROPERTY_KEY
The System property key for the Java Runtime Environment specification version.- See Also:
- Constant Field Values
-
LINE_SEPARATOR_PROPERTY_KEY
public static final java.lang.String LINE_SEPARATOR_PROPERTY_KEY
The System property key for the Line separator ("\n" on UNIX).- See Also:
- Constant Field Values
-
JAVA_CLASS_VERSION_PROPERTY_KEY
public static final java.lang.String JAVA_CLASS_VERSION_PROPERTY_KEY
The System property key for the Java class format version number.- See Also:
- Constant Field Values
-
JAVA_SPECIFICATION_NAME_PROPERTY_KEY
public static final java.lang.String JAVA_SPECIFICATION_NAME_PROPERTY_KEY
The System property key for the Java Runtime Environment specification name.- See Also:
- Constant Field Values
-
JAVA_VENDOR_URL_PROPERTY_KEY
public static final java.lang.String JAVA_VENDOR_URL_PROPERTY_KEY
The System property key for the Java vendor URL.- See Also:
- Constant Field Values
-
JAVA_VM_VERSION_PROPERTY_KEY
public static final java.lang.String JAVA_VM_VERSION_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation version.- See Also:
- Constant Field Values
-
OS_NAME_PROPERTY_KEY
public static final java.lang.String OS_NAME_PROPERTY_KEY
The System property key for the Operating system name.- See Also:
- Constant Field Values
-
OS_ARCH_PROPERTY_KEY
public static final java.lang.String OS_ARCH_PROPERTY_KEY
The System property key for the Operating system architecture.- See Also:
- Constant Field Values
-
JAVA_HOME_PROPERTY_KEY
public static final java.lang.String JAVA_HOME_PROPERTY_KEY
The System property key for the Java installation directory.- See Also:
- Constant Field Values
-
OS_VERSION_PROPERTY_KEY
public static final java.lang.String OS_VERSION_PROPERTY_KEY
The System property key for the Operating system version.- See Also:
- Constant Field Values
-
JAVA_COMPILER_PROPERTY_KEY
public static final java.lang.String JAVA_COMPILER_PROPERTY_KEY
The System property key for the Name of JIT compiler to use.- See Also:
- Constant Field Values
-
JAVA_VERSION_PROPERTY_KEY
public static final java.lang.String JAVA_VERSION_PROPERTY_KEY
The System property key for the Java Runtime Environment version.- See Also:
- Constant Field Values
-
JAVA_VM_SPECIFICATION_VERSION_PROPERTY_KEY
public static final java.lang.String JAVA_VM_SPECIFICATION_VERSION_PROPERTY_KEY
The System property key for the Java Virtual Machine specification version.- See Also:
- Constant Field Values
-
USER_DIR_PROPERTY_KEY
public static final java.lang.String USER_DIR_PROPERTY_KEY
The System property key for the User's current working directory.- See Also:
- Constant Field Values
-
JAVA_SPECIFICATION_VENDOR_PROPERTY_KEY
public static final java.lang.String JAVA_SPECIFICATION_VENDOR_PROPERTY_KEY
The System property key for the Java Runtime Environment specification vendor.- See Also:
- Constant Field Values
-
JAVA_VM_SPECIFICATION_NAME_PROPERTY_KEY
public static final java.lang.String JAVA_VM_SPECIFICATION_NAME_PROPERTY_KEY
The System property key for the Java Virtual Machine specification name.- See Also:
- Constant Field Values
-
JAVA_VM_VENDOR_PROPERTY_KEY
public static final java.lang.String JAVA_VM_VENDOR_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation vendor.- See Also:
- Constant Field Values
-
FILE_SEPARATOR_PROPERTY_KEY
public static final java.lang.String FILE_SEPARATOR_PROPERTY_KEY
The System property key for the File separator ("/" on UNIX).- See Also:
- Constant Field Values
-
PATH_SEPARATOR_PROPERTY_KEY
public static final java.lang.String PATH_SEPARATOR_PROPERTY_KEY
The System property key for the Path separator (":" on UNIX).- See Also:
- Constant Field Values
-
JAVA_LIBRARY_PATH_PROPERTY_KEY
public static final java.lang.String JAVA_LIBRARY_PATH_PROPERTY_KEY
The System property key for the List of paths to search when loading libraries.- See Also:
- Constant Field Values
-
USER_HOME_PROPERTY_KEY
public static final java.lang.String USER_HOME_PROPERTY_KEY
The System property key for the User's home directory.- See Also:
- Constant Field Values
-
JAVA_VM_NAME_PROPERTY_KEY
public static final java.lang.String JAVA_VM_NAME_PROPERTY_KEY
The System property key for the Java Virtual Machine implementation name.- See Also:
- Constant Field Values
-
JAVA_VM_SPECIFICATION_VENDOR_PROPERTY_KEY
public static final java.lang.String JAVA_VM_SPECIFICATION_VENDOR_PROPERTY_KEY
The System property key for the Java Virtual Machine specification vendor.- See Also:
- Constant Field Values
-
JAVA_IO_TMPDIR_PROPERTY_KEY
public static final java.lang.String JAVA_IO_TMPDIR_PROPERTY_KEY
The System property key for the Default temp file path.- See Also:
- Constant Field Values
-
FILE_ENCODING_PROPERTY_KEY
public static final java.lang.String FILE_ENCODING_PROPERTY_KEY
The System property key for the file encoding- See Also:
- Constant Field Values
-
JAVA_CLASS_PATH
public static final java.lang.String JAVA_CLASS_PATH
The System property for the Java class path.
-
USER_NAME
public static final java.lang.String USER_NAME
The System property for the User's account name.
-
JAVA_EXT_DIRS
public static final java.lang.String JAVA_EXT_DIRS
The System property for the Path of extension directory or directories Deprecated. This property, and the mechanism which implements it, may be removed in a future release..
-
JAVA_VENDOR
public static final java.lang.String JAVA_VENDOR
The System property for the Java Runtime Environment vendor.
-
JAVA_SPECIFICATION_VERSION
public static final java.lang.String JAVA_SPECIFICATION_VERSION
The System property for the Java Runtime Environment specification version.
-
JAVA_CLASS_VERSION
public static final java.lang.String JAVA_CLASS_VERSION
The System property for the Java class format version number.
-
JAVA_SPECIFICATION_NAME
public static final java.lang.String JAVA_SPECIFICATION_NAME
The System property for the Java Runtime Environment specification name.
-
JAVA_VENDOR_URL
public static final java.lang.String JAVA_VENDOR_URL
The System property for the Java vendor URL.
-
JAVA_VM_VERSION
public static final java.lang.String JAVA_VM_VERSION
The System property for the Java Virtual Machine implementation version.
-
OS_NAME
public static final java.lang.String OS_NAME
The System property for the Operating system name.
-
OS_ARCH
public static final java.lang.String OS_ARCH
The System property for the Operating system architecture.
-
JAVA_HOME
public static final java.lang.String JAVA_HOME
The System property for the Java installation directory.
-
OS_VERSION
public static final java.lang.String OS_VERSION
The System property for the Operating system version.
-
JAVA_COMPILER
public static final java.lang.String JAVA_COMPILER
The System property for the Name of JIT compiler to use.
-
JAVA_VERSION
public static final java.lang.String JAVA_VERSION
The System property for the Java Runtime Environment version.
-
JAVA_VM_SPECIFICATION_VERSION
public static final java.lang.String JAVA_VM_SPECIFICATION_VERSION
The System property for the Java Virtual Machine specification version.
-
USER_DIR
public static final java.lang.String USER_DIR
The System property for the User's current working directory.
-
JAVA_SPECIFICATION_VENDOR
public static final java.lang.String JAVA_SPECIFICATION_VENDOR
The System property for the Java Runtime Environment specification vendor.
-
JAVA_VM_SPECIFICATION_NAME
public static final java.lang.String JAVA_VM_SPECIFICATION_NAME
The System property for the Java Virtual Machine specification name.
-
JAVA_VM_VENDOR
public static final java.lang.String JAVA_VM_VENDOR
The System property for the Java Virtual Machine implementation vendor.
-
JAVA_LIBRARY_PATH
public static final java.lang.String JAVA_LIBRARY_PATH
The System property for the List of paths to search when loading libraries.
-
USER_HOME
public static final java.lang.String USER_HOME
The System property for the User's home directory.
-
JAVA_VM_NAME
public static final java.lang.String JAVA_VM_NAME
The System property for the Java Virtual Machine implementation name.
-
JAVA_VM_SPECIFICATION_VENDOR
public static final java.lang.String JAVA_VM_SPECIFICATION_VENDOR
The System property for the Java Virtual Machine specification vendor.
-
JAVA_IO_TMPDIR
public static final java.lang.String JAVA_IO_TMPDIR
The System property for the Default temp file path.
-
FILE_ENCODING
public static final java.lang.String FILE_ENCODING
The System property for the file encoding, the default is "UTF-8"
-
IS_OS_WINDOWS
public static final boolean IS_OS_WINDOWS
Is
true
if this is Windows.The field will return
false
ifOS_NAME
isnull
.
-
IS_JAVA_8
public static final boolean IS_JAVA_8
Is
true
if this is Java 8The field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_9
public static final boolean IS_JAVA_9
Is
true
if this is Java version 9.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_10
public static final boolean IS_JAVA_10
Is
true
if this is Java version 10.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_11
public static final boolean IS_JAVA_11
Is
true
if this is Java version 11.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_12
public static final boolean IS_JAVA_12
Is
true
if this is Java version 12.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_13
public static final boolean IS_JAVA_13
Is
true
if this is Java version 13.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_14
public static final boolean IS_JAVA_14
Is
true
if this is Java version 14.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_15
public static final boolean IS_JAVA_15
Is
true
if this is Java version 15.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_16
public static final boolean IS_JAVA_16
Is
true
if this is Java version 16.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_17
public static final boolean IS_JAVA_17
Is
true
if this is Java version 17.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_18
public static final boolean IS_JAVA_18
Is
true
if this is Java version 18.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_19
public static final boolean IS_JAVA_19
Is
true
if this is Java version 19.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_20
public static final boolean IS_JAVA_20
Is
true
if this is Java version 20.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_21
public static final boolean IS_JAVA_21
Is
true
if this is Java version 21.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_JAVA_22
public static final boolean IS_JAVA_22
Is
true
if this is Java version 22.xThe field will return
false
ifJAVA_VERSION
isnull
.
-
IS_LTS_JAVA_VERSION
public static final boolean IS_LTS_JAVA_VERSION
Istrue
if current Java version is Long Term Supported(LTS)
-
-
Method Detail
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.String key)
Gets a System property, defaulting to
null
if the property cannot be read.If a
SecurityException
is caught, the return value isnull
and a message is written toSystem.err
.- Parameters:
key
- the property key- Returns:
- the system property value or
null
if a security problem occurs
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.String key, java.lang.String defaultValue)
Gets a System property,
defaultValue
if the property cannot be read.If a
SecurityException
is caught, the return value isdefaultValue
and a message is written toSystem.err
.- Parameters:
key
- the property keydefaultValue
- the default value of property- Returns:
- the system property value or
defaultValue
if a security problem occurs
-
-