guys,
under linux, how can java access environment variables. currently i
have something like,
Properties envVars = new Properties();
Runtime r = Runtime.getRuntim();
Process p = null;
p = r.exec("env");
and this doesnt work. does anybody know how to get this to work.
thanks a lot.
stefanomnn - 13 Jun 2007 06:50 GMT
> guys,
>
[quoted text clipped - 7 lines]
> and this doesnt work. does anybody know how to get this to work.
> thanks a lot.
Hello!
Did you try taking input stream from process?
Gordon Beaton - 13 Jun 2007 06:56 GMT
> under linux, how can java access environment variables. currently i
> have something like,
[quoted text clipped - 4 lines]
>
> and this doesnt work. does anybody know how to get this to work.
"Something like" doesn't help anyone debug your real code.
Try using Properties.load(InputStream), passing the p.getInputStream()
as the argument.
If that doesn't work, post a complete example.
/gordon
--
stefanomnn - 16 Jun 2007 12:32 GMT
if you run on java 1.5,
you needn't use Process class,
toy can use System.getEnvs() method,
which return you a map of all environnement settings