2014-06-25 32 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()。