标签:
通过java获取计算机名
String hostname = "Unknown"; try { InetAddress addr; addr = InetAddress.getLocalHost(); hostname = addr.getHostName(); } catch (UnknownHostException ex) { System.out.println("Hostname can not be resolved"); } logger.info("The computer name is: " + hostname);
标签:
原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/4561526.html