systemutils.java
来自「JAVA 文章管理系统源码」· Java 代码 · 共 887 行 · 第 1/3 页
JAVA
887 行
/**
* <p>The <code>java.vm.specification.vendor</code> System Property. Java Virtual
* Machine specification vendor.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
*/
public static final String JAVA_VM_SPECIFICATION_VENDOR = getSystemProperty("java.vm.specification.vendor");
/**
* <p>The <code>java.vm.specification.version</code> System Property. Java Virtual Machine
* specification version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
*/
public static final String JAVA_VM_SPECIFICATION_VERSION = getSystemProperty("java.vm.specification.version");
/**
* <p>The <code>java.vm.vendor</code> System Property. Java Virtual Machine implementation
* vendor.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
*/
public static final String JAVA_VM_VENDOR = getSystemProperty("java.vm.vendor");
/**
* <p>The <code>java.vm.version</code> System Property. Java Virtual Machine
* implementation version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
*/
public static final String JAVA_VM_VERSION = getSystemProperty("java.vm.version");
/**
* <p>The <code>line.separator</code> System Property. Line separator
* (<code>"\n<"</code> on UNIX).</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String LINE_SEPARATOR = getSystemProperty("line.separator");
/**
* <p>The <code>os.arch</code> System Property. Operating system architecture.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String OS_ARCH = getSystemProperty("os.arch");
/**
* <p>The <code>os.name</code> System Property. Operating system name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String OS_NAME = getSystemProperty("os.name");
/**
* <p>The <code>os.version</code> System Property. Operating system version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String OS_VERSION = getSystemProperty("os.version");
/**
* <p>The <code>path.separator</code> System Property. Path separator
* (<code>":"</code> on UNIX).</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String PATH_SEPARATOR = getSystemProperty("path.separator");
/**
* <p>The <code>user.country</code> or <code>user.region</code> System Property.
* User's country code, such as <code>GB</code>. First in JDK version 1.2 as
* <code>user.region</code>. Renamed to <code>user.country</code> in 1.4</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since 2.0
* @since Java 1.2
*/
public static final String USER_COUNTRY =
(getSystemProperty("user.country") == null ?
getSystemProperty("user.region") : getSystemProperty("user.country"));
/**
* <p>The <code>user.dir</code> System Property. User's current working
* directory.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String USER_DIR = getSystemProperty("user.dir");
/**
* <p>The <code>user.home</code> System Property. User's home directory.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String USER_HOME = getSystemProperty("user.home");
/**
* <p>The <code>user.language</code> System Property. User's language code,
* such as 'en'.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since 2.0
* @since Java 1.2
*/
public static final String USER_LANGUAGE = getSystemProperty("user.language");
/**
* <p>The <code>user.name</code> System Property. User's account name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
*/
public static final String USER_NAME = getSystemProperty("user.name");
// Java version
//-----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
// values being set up
/**
* <p>Gets the Java version as a <code>float</code>.</p>
*
* <p>Example return values:</p>
* <ul>
* <li><code>1.2f</code> for JDK 1.2
* <li><code>1.31f</code> for JDK 1.3.1
* </ul>
*
* <p>The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*
* @since 2.0
*/
public static final float JAVA_VERSION_FLOAT = getJavaVersionAsFloat();
/**
* <p>Gets the Java version as an <code>int</code>.</p>
*
* <p>Example return values:</p>
* <ul>
* <li><code>120</code> for JDK 1.2
* <li><code>131</code> for JDK 1.3.1
* </ul>
*
* <p>The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*
* @since 2.0
*/
public static final int JAVA_VERSION_INT = getJavaVersionAsInt();
// Java version checks
//-----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
// values being set up
/**
* <p>Is <code>true</code> if this is Java version 1.1 (also 1.1.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1");
/**
* <p>Is <code>true</code> if this is Java version 1.2 (also 1.2.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2");
/**
* <p>Is <code>true</code> if this is Java version 1.3 (also 1.3.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3");
/**
* <p>Is <code>true</code> if this is Java version 1.4 (also 1.4.x versions).</p>
*
* <p>The field will <code>false</code> false if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4");
/**
* <p>Is <code>true</code> if this is Java version 1.5 (also 1.5.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5");
// Operating system checks
//-----------------------------------------------------------------------
// These MUST be declared after those above as they depend on the
// values being set up
// OS names from http://www.vamphq.com/os.html
// Selected ones included - please advise commons-dev@jakarta.apache.org
// if you want another added or a mistake corrected
/**
* <p>Is <code>true</code> if this is AIX.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*
* @since 2.0
*/
public static final boolean IS_OS_AIX = getOSMatches("AIX");
/**
* <p>Is <code>true</code> if this is HP-UX.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*
* @since 2.0
*/
public static final boolean IS_OS_HP_UX = getOSMatches("HP-UX");
/**
* <p>Is <code>true</code> if this is Irix.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*
* @since 2.0
*/
public static final boolean IS_OS_IRIX = getOSMatches("Irix");
/**
* <p>Is <code>true</code> if this is Linux.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*
* @since 2.0
*/
public static final boolean IS_OS_LINUX = getOSMatches("Linux") || getOSMatches("LINUX");
/**
* <p>Is <code>true</code> if this is Mac.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*
* @since 2.0
*/
public static final boolean IS_OS_MAC = getOSMatches("Mac");
/**
* <p>Is <code>true</code> if this is Mac.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?