Paul Reavis <[EMAIL PROTECTED]> writes:

> So I tried to access an environment variable for the first time today;
> no soap. Since System.getenv() is deprecated, I used
> System.getProperty(). I couldn't get it to fetch my variable with what I
> thought was the correct way:
> 
> bash$ export foo=bar
> bash$ java myapp

optimist

> However I can get it with:
> 
> bash$ java -Dfoo=bar myapp
> 
> What am I doing wrong here?

You are not doing anything wrong. Thats the only way to make
envir. variables available to your java program, (by merging them into
the System properties list via the -D option on the commandline).

Java 1.1 does not allow a java program to read system environment
variables since they are dependent of the plattform. Hence deprecation
of System.getenv()

-- 
Jan-Henrik Haukeland

Reply via email to