 <p>As suggested by all above, you can use <code>InetAddress.getByName("hostName")</code> but this can give you a cached IP, Read the java documentation for the same. If you want to get a IP from DNS you can use:</p> <pre><code>InetAddress[] ipAddress = DNSNameService.lookupAllHostAddr("hostName"); </code></pre>