Originally posted by Taariq Levack:
use System.getProperty/ies
As Michael said this works for the "default" environment variables. However it also works for system variables defined on the command line when the app is run. So for example you could run the app as:
You would then have the system property "username" defined inside your app. You can include as many "-Dname=value" pairs as you want (subject to OS command line length limits
) This would be the Windows way of running it. You can do something similar in *nix. A batch file or shell script to start up the app is helpful. Do some searching on the web - this is an old problem and
you should be able to find several solutions. I think I've even seen generic batch/shell scripts that would add all available env vars to the command line, but that may be overkill.
Good luck!
[ April 01, 2003: Message edited by: Eddie Sheffield ]
"When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon. You just have to outrun the halfling."