There are a few details of interest when getting system/environment properties.
First, System.getenv(String)
was introduced way-back-when, then deprecated. The deprecation (foolishly, IHMO) continued all the way into JSE 1.4.
It got re-introduced in JSE 5.
Those are set using the Environment Variables panel in Windows. Changes to the variables may not get picked up until your current VM is shutdown, and the CMD.exe instance is exited.
In contrast to the environment properties, Java also has Java system properties, accessible through System.getProperties()
. These variables can be initialized when the VM is started using a series -Dname=value
command line arguments. For example, the values for the properties maxInMemory
and pagingDirectory
are set in the command below:
C:\> java.exe -DmaxInMemory=100M -DpagingDirectory=c:\temp -jar myApp.jar
These properties can be modified at runtime, barring security policy restrictions.