Article View: borland.public.jbuilder.java.language
Article #15358Re: Reading Environment Variable
From: Tor Iver Wilhelmsen
Date: Mon, 21 Jun 1999 00:00
Date: Mon, 21 Jun 1999 00:00
24 lines
1274 bytes
1274 bytes
"Carole Masset" <carole.masset@plx.co.uk> writes:
> I have not found a way to read an environment variable from java using JDK
> 1.1.6. Can anybody help?
Doesn't work - apparently because there are platforms - let's call it
Macintosh - which does not use environment variables. Another reason
could be security.
> I am aware of System.getEnv but it is a deprecated API
... and actually has _never_ worked in a published version of
Java. Sun should simply have removed any references to it in the
released version instead of confusing people into believing it ever
worked.
> so I am currently trying using System.getProperty but I always get
> null.
You need to set the property first. E.g.:
java -Denv.HOME=%HOME% MyApplication
String home = System.getProperty("env.HOME");
Technical Details
Message-ID:
<uogianjo0.fsf@sds.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7kdnok$rs73@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a908ab2ace659fb1 X-Google-Attributes: gidf74b3,public From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> Subject: Re: Reading Environment Variable Date: 1999/06/21 Message-ID: <uogianjo0.fsf@sds.no> X-Deja-AN: 491995829 Sender: towi@SDSA1761 References: <7kdnok$rs73@forums.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language