Is it possible to set an environment variable at runtime from a Java application? In Java 1.5 java.lang.System class there is the getenv() method, I would only need a setenv() method...
Is it possible to modify the environment variables in the java process itself; not in the child process.
Is it possible to achieve it through JNI? And how would that work?
Thanks.
EDIT: Ok let me put it this way - Can we do the following with Java. Please answer.
- Can we modify the environment of the current process?
- Can we modify the environment of the parent process?
- Can we modify the environment of the child process?
Hemal Pandya has answered that "You can modify the environment of current and child processes but not of the parent process that spawned this process." Do you agree with this ?