• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

System variables

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I read a system environment variable from a java class without using System.getenv cause that is now depreciated
Cheers
 
Trailboss
Posts: 23791
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See: getenv for the new way of doing it.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic