getProperties
public static Properties getProperties()
-
Determines the current system properties.
First, if there is a security manager, its
checkPropertiesAccessmethod is called with no arguments. This may result in a security exception.The current set of system properties for use by the
getProperty(String)method is returned as aPropertiesobject. If there is no current set of system properties, a set of system properties is first created and initialized. This set of system properties always includes values for the following keys:Key Description of Associated Value java.versionJava Runtime Environment version java.vendorJava Runtime Environment vendor java.vendor.urlJava vendor URL java.homeJava installation directory java.vm.specification.versionJava Virtual Machine specification version java.vm.specification.vendorJava Virtual Machine specification vendor java.vm.specification.nameJava Virtual Machine specification name java.vm.versionJava Virtual Machine implementation version java.vm.vendorJava Virtual Machine implementation vendor java.vm.nameJava Virtual Machine implementation name java.specification.versionJava Runtime Environment specification version java.specification.vendorJava Runtime Environment specification vendor java.specification.nameJava Runtime Environment specification name java.class.versionJava class format version number java.class.pathJava class path java.library.pathList of paths to search when loading libraries java.io.tmpdirDefault temp file path java.compilerName of JIT compiler to use java.ext.dirsPath of extension directory or directories os.nameOperating system name os.archOperating system architecture os.versionOperating system version file.separatorFile separator ("/" on UNIX) path.separatorPath separator (":" on UNIX) line.separatorLine separator ("/n" on UNIX) user.nameUser's account name user.homeUser's home directory user.dirUser's current working directory Multiple paths in a system property value are separated by the path separator character of the platform.
Note that even if the security manager does not permit the
getPropertiesoperation, it may choose to permit thegetProperty(String)operation. -
-
Returns:
- the system properties Throws:
-
SecurityException- if a security manager exists and itscheckPropertiesAccessmethod doesn't allow access to the system properties.
See Also:
-
setProperties(java.util.Properties),SecurityException,SecurityManager.checkPropertiesAccess(),Properties
本文介绍了如何使用getProperties方法来确定当前系统的属性,并列举了多个关键系统属性及其含义,如Java运行环境版本、操作系统名称等。
378

被折叠的 条评论
为什么被折叠?



