java程序获取当前运行机器IP
2020-10-12 本文已影响0人
酷酷的美猴王
String localIp = null;
try {
InetAddress ia = InetAddress.getLocalHost();
localIp = ia.getHostAddress();
} catch (UnknownHostException e) {
logger.error("get local host error, caused by {}", e);
}