• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Environment vars in Java ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Environment vars in Java ...


  • Subject: Environment vars in Java ...
  • From: Dave Stewart <email@hidden>
  • Date: Thu, 1 Apr 2004 13:04:15 -0800

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.
_______________________________________________
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.


  • Prev by Date: Re: Webobjects 5.2 Documentation Search in xcode
  • Next by Date: Fwd: Environment vars in Java [SOLVED]
  • Previous by thread: Re: Webobjects 5.2 Documentation Search in xcode
  • Next by thread: Fwd: Environment vars in Java [SOLVED]
  • Index(es):
    • Date
    • Thread