The key of system. getproperty (string key) in Java is found here.

Source: Internet
Author: User
Tags file separator java format

One of the examples in "Java and mode" uses system. getproperty (string key)

System.getProperty("user.dir");

It's strange how he knows that the key is "user. dir ". Baidu has been sticking these keys for a long time. But where to find it? It took only half a day to find it:

In javase API, The getproperties method in the system class has the following descriptions:

Getproperties
public static Properties getProperties()
Determine the current system attribute.

First, if there is a security manager, directly call it without ParameterscheckPropertiesAccessMethod. This may cause a security exception.

SetgetProperty(String)The current system property set used by the methodPropertiesObject. If the current system property set does not exist, a system property set is created and initialized first. This system property set always contains the following key values:

Key Description of related values
java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url Java vendor URL
java.home Java installation directory
java.vm.specification.version Java Virtual Machine standard version
java.vm.specification.vendor Java virtual machine specification vendor
java.vm.specification.name Java virtual machine specification name
java.vm.version Java Virtual Machine implementation version
java.vm.vendor Java Virtual Machine implementation vendor
java.vm.name Java Virtual Machine implementation name
java.specification.version Java Runtime Environment Standard version
java.specification.vendor Java Runtime Environment specification vendor
java.specification.name Java Runtime Environment specification name
java.class.version Java format version number
java.class.path Java class path
java.library.path List of search paths when the library is loaded
java.io.tmpdir Default temporary file path
java.compiler Name of the JIT compiler to be used
java.ext.dirs Path of one or more extended Directories
os.name Operating system name
os.arch Operating System Architecture
os.version Operating system version
file.separator File separator ("/" in UNIX)
path.separator Path separator (":" in UNIX)
line.separator Line separator ("/n" in UNIX ")
user.name User Account Name
user.home User's home directory
user.dir Current working directory of the user

Multiple paths in the system property values are separated by path delimiters of the platform.

Note that even if the security manager does not allow executiongetPropertiesOperation, which may also allow execution
getProperty(String)Operation.

Return Value:
System attributes
Throw:
SecurityException-If the security manager exists and its checkPropertiesAccessThe method does not allow access to system properties.
For more information, see:
setProperties(java.util.Properties), SecurityException, SecurityManager.checkPropertiesAccess(), Properties

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.