Java tutorial
import java.net.InetAddress; public class Main { public static void main(String[] args) throws Exception { InetAddress address = null; if (args.length == 0) { System.out.println("usage: GetIP host"); System.exit(1); } address = InetAddress.getByName(args[0]); System.out.println(address.getHostName() + "=" + address.getHostAddress()); System.exit(0); } }