Posted on 2003-02-27
In class java.net.InetAddress
static InetAddress getLocalHost()
returns the local host data (i.e. the ip number of some default interface of the machine).
I have one machine where it throws the UnknownHostException. I wonder under which circumstances it should do that? There is no security manager involved so this cant be the reason.
The machine runs a linux kernel 2.4.7 and the jdk version is 1.2.2. The "hostname" command works and the machine HAS a eth0 interface with an ip number. Other applications (not java based) work fine, too, for example apache httpd and sendmail.
The same program on another machine would not throw the exception and give me the correct ip number.
Any help is appreciated. Thanks.