Here you can find the source of getIpAddress()
public static String getIpAddress() throws UnknownHostException
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static String getIpAddress() throws UnknownHostException { InetAddress address = InetAddress.getLocalHost(); return address.getHostAddress(); }//from ww w.ja v a2 s . com }