java获取本机IP
public static void main(String[] args) throws UnknownHostException
{
InetAddress inet = InetAddress.getLocalHost();
System.out.println("本机的ip=" + inet.getHostAddress());
}//获取本抓取机IP
String ip="";
InetAddress inet;
try {
inet = InetAddress.getLocalHost();
ip=inet.getHostAddress();
logger.debug("ip:{}",ip);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}