Here you can find the source of getIpHostnameLocal()
public static String getIpHostnameLocal()
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { public static String getIpHostnameLocal() { try {/*from www . jav a2s .com*/ InetAddress ip = InetAddress.getLocalHost(); return ip.getHostName(); } catch (Exception e) { return "not-found"; } } }