" Host name-to-IP address resolution is accomplished through the use of a combination of local machine configuration information and network naming services such as the Domain Name System (DNS) and Network Information Service(NIS). "
This can cause problems for reverse lookups where the Fully Qualified Domain Name (FQDN) is required. In many cases, the host name returned by getHostName for an enquiry on the localhost is the netbios computer name and not the FQDN as has been reported by many developers. Reverse DNS lookups can be carried out with JNDI and the DNS service provider, available with J2se v1.4, or added as an extension package to j2se v1.3 and lower.
The Dns2000 utility Java application provides an elementary demonstration of using JNDI/DNS provider for reverse DNS lookups to provide FQDN results. If provides similar functionality to the win2000 utility nslookup.exe. The utility is designed to demonstrate how JNDI is used to read the DNS service provider PTR record for reverse DNS lookup. Since the initial context constructor requires specification of a DNS server, this is specified either as a command line parameter, or if not provided, is discovered by invoking the Win2000 native application "nslookup.exe".
Dns2000 application source code
dnsmigquery.exe (windows popup version)