Java tutorial
//package com.java2s; import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static String getServiceIp(String host) { InetAddress myServer = null; try { myServer = InetAddress.getByName(host); } catch (UnknownHostException e) { e.printStackTrace(); } if (myServer == null) { return "0"; } return myServer.getHostAddress(); } }