Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

To getenv or not getenv

Thread view: 
lordy - 28 Jul 2006 19:31 GMT
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.

Cheers,
Lordy
Roland de Ruiter - 28 Jul 2006 20:41 GMT
> 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
[quoted text clipped - 6 lines]
> Cheers,
> Lordy

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.out.println("java.runtime.version="
                    + System.getProperty("java.runtime.version"));
            System.out.println("PATH=" + System.getenv("PATH"));
        }
    }

On JRE 1.4.2:
    java.runtime.version=1.4.2_12-b03
    java.lang.Error: getenv no longer supported, use properties and
    -D instead: PATH
            at java.lang.System.getenv(System.java:691)
    [...]

On JRE 1.5.0:
    java.runtime.version=1.5.0_07-b03
    PATH=C:\Data\bin\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;[...]
Signature

Regards,

Roland

lordy - 28 Jul 2006 20:48 GMT
>> 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
[quoted text clipped - 9 lines]
> 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.

Cheers,

Slightly more than deprecated then !  

Lordy


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.