linux java.net.UnknownHostException異常

異常場景:java

  使用InetAddress.getLocalHost().getAddress(); 獲取address byte數組。在windows上開發的時候,沒有問題。部署到linux時報 java.net.UnknownHostException異常。linux

 

解決方案:windows

  在linux的hosts文件中,增長以下配置數組

127.0.0.1 test2.net

相關文章
相關標籤/搜索