System Environment
This environment is a system-dependent mapping from names to values which is passed from parent to child processes. Primarily the set of variables that define or control certain aspects of process execution.
System Properties
Java maintains a set of system properties for its operations. Each java system property is a key-value (String-String) pair.
System Properties vs Environment Variables
System properties and environment variables are both conceptually mappings between names and values. Both mechanisms can be used to pass user-defined information to a Java process. Environment variables have a more global effect, because they are visible to all descendants of the process which defines them, not just the immediate Java subprocess. They can have subtly different semantics, such as case insensitivity, on different operating systems. For these reasons, environment variables are more likely to have unintended side effects. It is best to use system properties where possible. Environment variables should be used when a global effect is desired, or when an external system interface requires an environment variable (such as PATH).
References
- What is System Environment - Stack Exchange
- Java Process: What is the Environment?
- getenv - Oracle Docs
- System Environment - IBM
- When to use environment variables vs. system properties? - Stack Overflow
- Java system properties and environment variables
- Java System.getProperty vs System.getenv
Backlinks