Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > To getenv or not getenv

Reply
Thread Tools

To getenv or not getenv

 
 
lordy
Guest
Posts: n/a
 
      07-28-2006
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

 
Reply With Quote
 
 
 
 
Roland de Ruiter
Guest
Posts: n/a
 
      07-28-2006
On 28-7-2006 20:31, lordy wrote:
> 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
>

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;[...]
--
Regards,

Roland
 
Reply With Quote
 
 
 
 
lordy
Guest
Posts: n/a
 
      07-28-2006
On 2006-07-28, Roland de Ruiter <> wrote:
> On 28-7-2006 20:31, lordy wrote:
>> 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
>>

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.getenv() Benjamin Lerman Java 11 03-27-2009 07:20 AM
Is there a getEnv(String string) method in javax.servlet.http package? RC Java 1 07-07-2005 03:49 PM
setuid() and getenv()? vertigo Perl 1 07-17-2004 08:32 AM
getenv and carriage returns Chad Paquette C Programming 5 02-05-2004 07:20 AM
getenv problem jain-neeraj@lycos.com C Programming 3 06-28-2003 08:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57