Thanks,
Daniel
--
To reply to me directly, please remove "ANTISPAM" from the reply-to
email address.
Try java.net.InetAddress.getLocalHost().getHostName() -- perhaps that's what
you want. The problem with using HOST as an environment variable is that it
doesn't exist on all systems.
Chris Smith
Thanks.
Chris Smith wrote:
--
two possibilities
a) use the InetAddress interface (preferred)
b) use System.getProperty("env.hostname")
while starting the VM with additional option -Denv.hostname="`hostname`"
This also works in principle on all platforms but you have to modify
the call of `hostname` to the platform needs...
--
Harald Bock, Lucent Technologies, Germany
Phone : +49 911 526-3729 Dept. :FLI3 (GSM Development Software Support)
Mobile: +49 170 935-8003 Addr. :Thurn-und-Taxisstr.14, 90411 Nuremberg
Fax : +49 911 526-3183 mailto:HB...@Lucent.com
Thanks,
Daniel
Harald Bock wrote:
--
You might also try using Runtime.exec(...) and issuing a hostname command.
Personally, I think it was stupid to deprecate System.getenv(String). I have yet
to work on an operating system without some environment-variable-like metaphor.
And if Macs don't have such a thing, then have an empty environment variable
space. Besides, they didn't deprecate Runtime.exec(String command, String[]
envp); I wonder what that does on toy operating systems? But what do I know?
Hope this helps!
-Jerry Oberle