Environment Variables with java

R

Ruppen Pascal

Hello

I search a solution where I can use environment variables with java. The
method getenv(String) is deprecated???

Thx pascal
 
M

Michael Borgwardt

Ruppen said:
Hello

I search a solution where I can use environment variables with java. The
method getenv(String) is deprecated???

And with good reasons. Environment variables work quite differently
on different operating systems. If you really need them, use Runtime.exec()
to get the variables from the shell.
 
M

Mike Schilling

Michael Borgwardt said:
And with good reasons. Environment variables work quite differently
on different operating systems.

As do files and threads; how foolish of Java to support *them*. An
environment variable abstraction would actually be quite useful.

One thing you can do is run your Java program from a shell script/batch
file/etc. that generates -Dname=value flags for the relevant environment
variables, turning them into system properties.
 
N

Neal Gafter

Yes, we removed support for them in a previous release. Sorry. They'll be back
in J2SE 1.5.0.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top