Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

setting an (win console) environment variable programatically with jave

2 views
Skip to first unread message

Enrique Quesada

unread,
Jul 24, 2004, 11:18:00 PM7/24/04
to
Hello all,
is there a way to set an environment variable with Java?
I'm working on a console app and depending on user supplied args would like
to set one, but the following is not working for me:

Runtime.getRuntime().exec("set some_env_var = some_value");

All I get from the above is an exception: java.io.IOException:
CreateProcess: set some_env_var = some_value error = 2.

Is there a way of accomplishing this ?

OS= XP
App type= console, command line
Java= j2sdk1.4.2_04

Thanks


0 new messages