File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes System variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "System variables" Watch "System variables" New topic

System variables

Dave Smith

Joined: Jan 12, 2000
Posts: 23
How do I read a system environment variable from a java class without using System.getenv cause that is now depreciated
paul wheaton

Joined: Dec 14, 1998
Posts: 20973

Since this doesn't have anything to do with certification, I'm going to move it to the General Java forum where it will probably get more attention.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
See: java.lang.String)" rel="nofollow">getenv for the new way of doing it.

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
This is one of those rampant deprecations which really irritates me. By all means recommend System.getProperty for getting program configuration information, but that's not the only use for environment variables. I can now no longer write something as simple as a CGI script in Java without getting deprecation warnings.
Similarly for deprecating all the constructors of PrintStream. Imagine a method in which I accept a single parameter, a PrintStream to log errors to. I could pass in System.out, System.err or a PrintStream of my own (say to a file). Except that I can't. I can't make a PrintStream like System.out without getting deprecation warnings.
In my view deprecation should only be used where a full and complete replacement is available. In these cases, that's just not true, and we have to live with using deprecated methods.
Wake up Sun. Deprecation should not be done lightly.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: System variables
It's not a secret anymore!