gcj: accessing environment variables

Mohan Embar gnustuff@thisiscool.com
Thu May 1 00:56:00 GMT 2003


Hi Nic,
>And I don't really care about portability for environment
>variables. They're a unix feature and that's where I use them.
><end of rant>

The Win32 MSVCRT getenv() function has an identical API to UNIX,
so a UNIX implementation would have compiled and worked on Win32
without a hitch.
This being said, how I feel about the omission of this depends on
what mood I'm in when I wake up in the morning. There's something
to be said for passing a known, controlled environment to an executable
and funneling any system environment variables to a Java program from a
shell script or batch file seems pretty innocuous to me. If you have many
such variables, you can group them in a properties file. Although I lamented
their absence of this in the beginning, I'm not really feeling the pinch anymore.
If the environment variables are set in locally in a shell script launching the
application, it's just as easy to set them in a properties file or pass them via
the command line. And global environment variables seem sort of like global
variables in general to me, with all of their associated potential global namespace
pollution pitfalls.
So I guess you see what mood I'm in today. We'll see what tomorrow brings... :)
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /