-1

Possible Duplicate:
How do I set environment variables from Java?

I know, I can get a variable from environment by System.getenv, but how do I put a variable into environment in java?

Thanks

Community
  • 1
  • 1
xyz
  • 8,607
  • 16
  • 66
  • 90

1 Answers1

0

Environment is associated with each process in the system and is inherited by a child process from the parent process. Every process can read and modify its own environment and it can prepare environment to be passed to a child process. For example, you cannot put variables into the shell/cmd.exe from which you launched your JVM from within the JVM.

In order to put a variable into the environment of a process you're about to execute you can use ProcessBuilder.

Adam Zalcman
  • 26,643
  • 4
  • 71
  • 92