[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: how to set system environment variables programmatically?

Dear Joneo,

environment variables are local to your process. Starting a new process will create a *copy* of your environment variables and whatever the new process does, e.g. your batch file, does not affect your own environment.

The solution is quite simple. Your call to "java.lang.Runtime.exe" method comes in different flavours: Some have a String array where *you* provide all the environment variables for the new process. Here is the point to add your new environment variable "abc=whatever".

Bye,

Guünther

joneo wrote:
hi all,

May i know how can i set the system environment variables programmatically? i created a bat file which do the set command. but after i execute that batch file through runtime.exec, and i try to system.getenv("abc"), it print null. actually i want it to be set in system environment variables as my next runtime.exec will search for that environment variables to perform some task. so could anyone help me on it?thanks.