java Exception in thread “main” java.net.UnknownHostException: Test: Test: unknown error OS ubuntu

后端 未结 2 748
[愿得一人]
[愿得一人] 2020-12-30 04:39

This error is related to my previous question where I had an error with InetAddress.getLocalHost(). I found a suggestion to add an entry in /etc/hosts

相关标签:
2条回答
  • 2020-12-30 05:39

    There's a chance that you might be contacting to an external ip address in your application and you are not connected to the internet. So, Check your Internet Connection before making some change to host/dns or any other...

    There's also a possibility that you require a VPN Connection to be in the some particular network to access those external url/ip. So, check that too.

    Cheers ;-)

    0 讨论(0)
  • 2020-12-30 05:44

    Your host name is Sachin. The exception in thread "main" java.net.UnknownHostException: Sachin: Sachin: unknown error show that.

    Add Sachin to /etc/hosts

    myip     localhost
    127.0.0.1   localhost
    127.0.1.1   test5
    127.0.0.1   Sachin
    
    0 讨论(0)
提交回复
热议问题