I think it should work to get the IPAddress and then create a new InetAddress:
InetAddress add = InetAddress.getByName("xxx.xxx.xx.x");  
Now you can use add.getHostName() and you should get the fully qualified
hostname. 
Markus

On 12-Nov-98 Mark Hofmann wrote:
> Hi all,
> 
> I've posted that question a few days ago to java.lang.programmer
> but got no response :-(
> But, since this problem is really bugging me, and there might be some
> people in this list that run there progs under NT and Linux, just as me,
> I hope to find a solution here.
> Anyway, here is the problem, easy and simple ....
> 
> when I use
>         String localhostname=(InetAddress.getLocalHost()).getHostName();
> under Linux I get the fully qualified hostname, under NT just the local
> hostname, eg. host instead of host.my.domain.com
> 
> Our admin says that its an NT feature/problem (you never know) because it
> stores both names separately and returns usually only the local hostname.
> 
> Is there a workaround for that, so I can get the fully qualyfied hostname or
> do I just have to live with that? Or even better is our system misconfigured
> and I can tell our admin that he's wrong (which is always fun ;-) )
> 
> Thanks in advance
> 
>  Mark
> 
> 
> 
> --
> M a r k  H o f m a n n
> Department of Computer Science
> University of Stellenbosch / South Africa
> phone: +27-82-7449880

Reply via email to