|
You need to specify a property to java, which holds the value
of the environment variable.
That is, for System.getProperty("AA") to return the
value of the environment variable named 'AA', you need to run this on
unix:
java -DAA=$AA <otherswitches>
<classname>
The defacto standard set by Java's builtin system properties
(such as "java.class.path", instead of "CLASSPATH") is to
have descriptive names, all in lower case, with words seperated by '.'
characters - rather than any OS standard, such as all in lower case, with words
seperated by '_' characters. I've specified a local standard that insists that
properties holding the values of environment variables follow the defacto
standard, and prefix the environment variable name with 'system.'. For example,
we have an environment variable named DW_HOME, which is accessible by the Java
property named 'system.dw.home'. The property is specified in a shell script,
using this -D switch: '-Dsystem.dw.home=$DW_HOME'.
Hi guys,
My swing applet communicates to the server through rmi. Hence my
rmiserver will be running in the linux box and from there i have to get the
user environment variables.
i have set the user environment variable in linux as export
AA=Welcome I have used System.getProperty("AA") of which i
assigned value as welcome but instead i am getting the value as null.
I try to use System.getenv("AA"). it compiles fine, but
at the runtime it the following error is displayed
Exception in thread "main" java.lang.Error: erties and -D
instead: AA at
java.lang.System.getenv(Unknown
Greg Munt wrote:
-----Original Message----- From: Christian
Pesch <[EMAIL PROTECTED]> To: Greg Munt
<[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, March 19, 2001 02:08 Subject: Re: how to get user
environment variable in linux
>Greg Munt schrieb: > >> Environment variables
should be passed in as Java properties. > >Did you read
the first mail in the thread?
Yes. I did.
raviprakash wrote: > >"I have to capture the value
of the user environment variable and >manipulate the value of AA
in the swing programs." > >The original poster wanted
to _manipulate_ the environment >variables via an swing gui.
Think, then write.
They want to "manipulate the value of AA in the swing
programs" - they said nothing about manipulating AA itself, nor
about needing to change the value of that envronment variable. (You
can't do that in Java.)
They wanted to know how to obtain the value of an environment
variable, so that they could manipulate that value. I gave them
information which would assist them in achieving that goal. Instead
of misinterpreting, and throwing around implicit insults, perhaps
you should do something like.. ooh, I don't know.. think, then write
- perhaps?
_______________________________________________ Swing mailing
list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/swing
|