Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

 Below is my code implementation :

 java.net.UnknownHostException virtualhostname at 

 java.net.InetAddress.lookUpHostByName(InetAddress.java:506)

It works fine on my PC, but when I run it on an emulator I’m not able to check the HTTP status. I get this error “java.net.UnknownHostException: Invalid hostname for server: local” 

Can anyone tell me how to resolve this error?  

1 Answer

0 votes
by (19.7k points)

It means there’s no server as “local” when you try to connect to your local computer. You can try to use the hostname “localhost” instead of the IP address. 

 If you want to learn more about Javathen go through this Java tutorial by Intellipaat for more insights.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Mar 2, 2020 in Java by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Mar 2, 2020 in Java by Sudhir_1997 (55.6k points)

Browse Categories

...