Fwd: Environment vars in Java [SOLVED]
Fwd: Environment vars in Java [SOLVED]
- Subject: Fwd: Environment vars in Java [SOLVED]
- From: Dave Stewart <email@hidden>
- Date: Thu, 1 Apr 2004 16:37:37 -0800
Hey list!
I figured it out, or at least I got it working! The "trick" for me was
to:
1. Forget the documentation for XCode entirely.
2. Insert the following line (exactly as is - variations didn't work at
all:) in the "Launch Arguments":
-DdevelopingServer="true"
Suddenly everything works! Sweet!!
Begin forwarded message:
> From: Dave Stewart <email@hidden>
> Date: April 1, 2004 1:04:15 PM PST
> To: XCode List <email@hidden>
> Subject: Environment vars in Java ...
>
> Hi list! Long time lurker, infrequent poster here ...
>
> I have a question in XCode that's driving me nuts.
>
> The project is a Java XML-RPC server that's being developed on a Mac
> but deployed on an AIX server. Some things are different between
> develop and deploy (like where the log files go), so I use a boolean
> to determine where these things should go. Currently, when I switch
> from develop to deploy, I have to find these booleans where I use them
> (only 3 files) and "trip" them to false to indicate I'm deploying on
> the server. Not really a problem, but clumsy.
>
> Obviously, it would be much nicer if I set an environment variable in
> each build style, so when I switch from develop to deploy the boolean
> is set for me (more specifically, I'll set it in the constructor
> depending on the value of this environment variable). But I just can't
> seem to get this to work.
>
> I've looked over the XCode docs, which seem to indicate that I need to
> do the following:
>
> 1. supply a name and value for the environment var in the
> "Environment Variables" for the executable. In my case, I've given it
> a name of "developingServer" and a value of "true" for the development
> executable (without the quotes, although I even tried putting quotes
> around them in case it mattered. It didn't).
> 2. read the environment variable with a BSD system call, like
> getenv(). Since I'm in Java, that should be a call to
> System.getProperty("developingServer").
>
> But this just doesn't work. I mean I'm getting a null pointer back
> from System.getProperty("developingServer") indicating there is no
> property with that key and I can spit out the entire
> System.getProperties() to standard out and see that "developingServer"
> is just not there. Hmmm.
>
> OK, so what am I missing here? Any help would be appreciated.
>
> I have tried searching the archives, but wasn't very successful. The
> archives did try my patience though ...
> ;-)
>
>
> Dave Stewart
> Aqua~Flo Supply (Goleta CA)
> dstewart at aquaflo dot com
>
> The trouble with doing something right the first time
> is that nobody appreciates how difficult it was.
>
>
Dave Stewart
Aqua~Flo Supply (Goleta CA)
dstewart at aquaflo dot com
There are only two industries that refer to their customers as "users".
-Edward Tufte
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.