Register now or log in to join your professional community.
Is that public ip address or private LAN address.
considering as public IP:
the domain you mentioned is "java.sun.com" ie an example. where "java" is subdomain.
=> go to the cpanel of the domain and point the ip192.18.97.39 to "java", ie
create cname =java, TTL=14400 , IP=192.18.97.39
now for reverse lookup or fqdn, you need to ask your ISP for PTR.
considering as Private IP:
set the name of the computer as "java",
put its ip address as192.18.97.39
register the computer in the domain server which is named as "sun.com" within your LAN network
You can use the below code :
package com.devdaily.javasamples;import java.net.InetAddress;import java.net.UnknownHostException;/** * Shows how to convert an IP address into a hostname. * Created by Alvin Alexander, http://devdaily.com. */public class InetAddressExample{ public static void main(String[] args) throws UnknownHostException { String hostname = InetAddress.getByName("192.18.97.39").getHostName(); System.out.println("hostname = " + hostname); }}
Copied from : http://alvinalexander.com/blog/post/java/java-faq-convert-ip-address-to-hostname