-
System properties are set on the Java command line using the
-Dpropertyname=valuesyntax. They can also be added at runtime
usingSystem.setProperty(String key, String value)or via the various
System.getProperties().load()methods.
To get a specific system property you can useSystem.getProperty(String key)orSystem.getProperty(String key, String def). -
Environment variables are set in the OS, e.g. in Linux
export HOME=/Users/myusernameor on WindowsSET WINDIR=C:\Windowsetc,
and, unlike properties, may not be set at runtime.
To get a specific environment variable you can useSystem.getenv(String name).