To getenv or not getenv

Discussion in 'Java' started by lordy, Jul 28, 2006.

  1. lordy

    lordy Guest

    I'm using 1.4.2 for some commecial development. I was just about to set
    a property and pass it on the command line when I noticed that System.getenv is
    not deprecated in 1.5.0. So is it bad form to use a deprecated 'getenv'
    in 1.4.2 given its new lease of life in 1.5.0??

    Being 'allowed' to use getenv would make certain parts of the program
    more expressive.

    lordy, Jul 28, 2006
    1. Advertisements

  2. There's no point in using it on 1.4.2, since System.getenv(String)
    always throws an error when try to run it on a 1.4.2 JRE.

    Compare output of the following program:
    public class ToGetenvOrNotToGetenv
    public static void main(String[] args)
    + System.getProperty("java.runtime.version"));
    System.out.println("PATH=" + System.getenv("PATH"));

    On JRE 1.4.2:
    java.lang.Error: getenv no longer supported, use properties and
    -D instead: PATH
    at java.lang.System.getenv(

    On JRE 1.5.0:
    Roland de Ruiter, Jul 28, 2006
    1. Advertisements

  3. lordy

    lordy Guest


    Slightly more than deprecated then !

    lordy, Jul 28, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.