John A. Zinky wrote:
> We have not been able to find a configuration of Linux Red Hat 5.0 and
> jdk 1.1.x that works for the following one line test program.
> 
> public class TestGetLocalHost {
>   public static void main(String[] args) {
>     try {
>       System.out.println(java.net.InetAddress.getLocalHost());
>     } catch (Exception e) { e.printStackTrace(); }
>   }}
> 
> The Test program prints the IP address of local host
> (A necessary function for servers that need to publish their location)
> 
> On Solaris,NT, and  Red Hat 4.0/jdk1.1.3 this works: e.g:
>    guava.bbn.com/171.78.82.34
> On Linux Red Hat 5.0 jdk1.1.5 this returns the loopback address: e.g:
>    localhost/127.0.0.1
> 
> We have traced the problem in to the C routines for native platform
> on Line 298 in .../jdk1.1.5/src/java/net/InetAddress.java
>             localHost.hostName = impl.getLocalHostName();
>             System.out.println("local host name: " + localHost.hostName);
> 
> On linux:     local host name: localhost
> On Solaris:   local host name: guava.bbn.com
> 
> **** Questions *****
> 1) Does anyone have a Linux RedHat 5.0 configuration where this program works?

It works fine for me: RedHat 5.0 and jdk1.1.6-v1 (sbb). Make sure you
have the
latest version of libc installed (can be found at www.redhat.com).

> [ .... ]
> 2) Could this be a configuration error in the linux host?

I believe that is the case. Try with DNS configured.

> [ .... ]

/Per Widerlund

Reply via email to