gpt4 book ai didi

java - System.getProperties 的属性从何而来?

转载 作者:行者123 更新时间:2023-12-01 22:06:48 24 4
gpt4 key购买 nike

当我调用方法 System.getProperties(); 并打印它们时,它给出一个包含键值对的大列表,无需设置属性。 Java 从哪里获取那些属性来自?

最佳答案

来自托管 Java 的操作系统(环境)。检查Oracle documentation

In Properties, we examined the way an application can use Properties objects to maintain its configuration. The Java platform itself uses a Properties object to maintain its own configuration. The System class maintains a Properties object that describes the configuration of the current working environment. System properties include information about the current user, the current version of the Java runtime, and the character used to separate components of a file path name.

<小时/>
Key                 Meaning
----------------- --------------------------------------------------------------------------
"file.separator" Character that separates components of a file path. This is "/" on UNIX and "\" on Windows.
"java.class.path" Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in the path.separator property.
"java.home" Installation directory for Java Runtime Environment (JRE)
"java.vendor" JRE vendor name
"java.vendor.url" JRE vendor URL
"java.version" JRE version number
"line.separator" Sequence used by operating system to separate lines in text files
"os.arch" Operating system architecture
"os.name" Operating system name
"os.version" Operating system version
"path.separator" Path separator character used in java.class.path
"user.dir" User working directory
"user.home" User home directory
"user.name" User account name

关于java - System.getProperties 的属性从何而来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32587775/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com