Java examples for Network:IP Address
get Ip Address from Inet4Address
//package com.java2s; import java.net.Inet4Address; import java.net.UnknownHostException; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getIpAddress()); }//from ww w. j a v a 2s.com public static String getIpAddress() throws UnknownHostException { return Inet4Address.getLocalHost().getHostAddress(); } }