Is it possible to retrieve the modified value of an environment variable in a Java program?
I tried using System.getenv()
. But the new value is not reflected in the program. The scenario is this:
The program retrieves the value of an environment variable.
The value of this variable is changed externally, while the program is still running. (It could be even manual process, like for eg, in Windows, the user changes the value from Advanced tab in My Computer->properties)
The program retrieves the value of the environment variable again.
The second time the value is retrieved, it should get the modified value. I found that using System.getenv()
gave me the old value only. Is there any reliable method for this? (This requirement is specific to Windows, but would love to hear general solutions too)