Article View: borland.public.jbuilder.java.language
Article #14468Re: environment variables from within Java
From: Kevin D
Date: Wed, 01 Sep 1999 00:00
Date: Wed, 01 Sep 1999 00:00
52 lines
2062 bytes
2062 bytes
I got it now
If I run with
java -Duserapp_prefs="\\myserver\data\users"
java adds "userapp_prefs" to system properties.
If I run with
java -DMyPrefs.userapp_prefs="\\myserver\data\users"
java creates a new class MyPrefs and
System.out.println(System.getProperty("mypref.userapp_prefs","NOT
SET" ));
will return the value assigned above.
Anyway
Thanks again.
Paul Furbacher [TeamB] wrote in message
<37CC4EC7.408B2B2A@bilbo.bio.purdue.edu>...
>Kevin D wrote:
>
>> Is it possible to access the environment variables from within Java?
>> Win NT, Win 95 or Unix
>
>It depends. See the JavaDocs for the System class. There are
>some which are obtainable via System.getProperty(...).
>However, those which you have created are not available.
>
>> If not, is the -D runtime parameter the work-around?
>
>Yes, you could do this. In fact, someone just wrote about doing
>this last week. The problem was that it works from the command
>line, but not from within the IDE (an inconsistency which is puzzling).
>So, if you had an environment setting called "JavaHome", you could
>write the command line:
>
> > set JavaHome=c:\jdk1.1.8
> > java -DjavaHome=%JavaHome% ...
>
>but if you set the -D parameter in the Run | Parameters... dialog
>it would yield "%JavaHome%" and not "c:\jdk1.1.8". Quite
>unfortunate. You may choose to file a bug report on this
>novel feature of the IDE (note that I didn't call it a bug).
>
>
>Paul Furbacher (TeamB)
Technical Details
Message-ID:
<7qjp1i$d0212@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7qhc70$aho9@forums.borland.com> <37CC4EC7.408B2B2A@bilbo.bio.purdue.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,1698c67948d2aa23 X-Google-Attributes: gidf74b3,public From: "Kevin D" <kevind@saccapital.com> Subject: Re: environment variables from within Java Date: 1999/09/01 Message-ID: <7qjp1i$d0212@forums.borland.com> X-Deja-AN: 519829360 References: <7qhc70$aho9@forums.borland.com> <37CC4EC7.408B2B2A@bilbo.bio.purdue.edu> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language