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.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...