2011-06-09 57 views
1

專用Linux服務器拋出UnknownHostException。Java - UnknownHostException

InetAddress addr; 
    try { 
     addr = InetAddress.getLocalHost(); 
    } catch (UnknownHostException e) { 
     throw new InstantiationError("cannot find hub ip"); 
    } 
+0

你吃過看看這些http://www.google.co.uk/search?q=getLocalHost+UnknownHostException因爲我相信多個可能的原因。 – 2011-06-09 15:20:13

+2

[InetAddress.getLocalHost()throws UnknownHostException]的可能重複(http://stackoverflow.com/questions/1881546/inetaddress-getlocalhost-throws-unknownhostexception) – 2011-06-09 15:21:40

回答

3

您可能沒有在localhost映射您system32\drivers\etc\hosts(WIN)/etc/hosts(Linux)的