• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in "URL" class pls help me  RSS feed

 
kannagiri rosei
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i am using URL class to connect website url and copy the index.html

to C;//test//abcd.html

Error is:
Opening connection to www.ibm.com.../index.html
java.net.UnknownHostException: www.ibm.com


my code is here
================

URL url = new URL("http://www.ibm.com/index.html");

System.out.println("Opening connection to " + url.getHost() + "..."+url.getFile());

URLConnection urlC = url.openConnection();


am not able to connect the URL?

2.please help how to find ipaddress(web sites) to update in my host file
--------------------------------------------------------------------------------
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your machine needs to be able to resolve host names.
This is typically done with a system called DNS.
Your machine acts as a DNS client, making requests to a configured DNS server for resolution of host names, such as "www.ibm.com".

Nothing to do Java, and certainly not advanced.
Google is your point of reference.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!