tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Kaufman <>
Subject RE: Getting the user environment variable::Need help
Date Tue, 07 Aug 2001 14:33:21 GMT
1) This isn't a Tomcat question: if you'd done the same in a java
application, you'd have found the same thing.  There are forums, newsgroups,
and mailing lists for Java questions.

2) You're confusing environment variables with properties.  Properties are
defined either by loading them from a properties file, or by specifying them
on java's command line (with "-D").

3) There is a method, System.getenv(), to get environment variables, but
it's deprecated (the whole concept of environment variables is incredibly
OS-specific).  So you really _should_ be using properties, or
<context-param> elements defined in your application's web.xml.  Look at
java.util.Properties for the former, and the servlet spec for the latter.

                                        -- Bill K. 

> -----Original Message-----
> From: Nilanjan Das []
> Sent: Tuesday, August 07, 2001 7:12 AM
> To: tomcat jakarta
> Subject: Getting the user environment variable::Need help
> Hi,
> I am on HP-UX and trying to access one user environment varaible from
> the Java code using
> System.getProperty() method but it is returning NULL. Can anyone point
> out why? This is what I did:
> $export TEST=testing
> $echo $TEST
> testing
> But when I execute System.getProperty("TEST") from my code, it returns
> Can any of you help?
> Thanks,
> Nilanjan

View raw message