2014-06-25 29 views
0

有没有办法让c#中的system.environment.machinename返回相同的东西 - 但在java中?我试过InetAddress.getLocalHost().getHostName();并使用JCIFS开源库。java中的system.environment.machinename?

+0

您是否检查过:http://stackoverflow.com/questions/1100266/find-physical-machine-name-in-java – assylias

回答

0

您是否尝试过使用JCIFS?

InetAddress addr = InetAddress.getByName("127.0.0.1"); 
String host = addr.getHostName(); 

你得到了什么,当你试图

InetAddress.getLocalHost()的gethostname()。