• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

problem in "URL" class pls help me

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
--------------------------------------------------------------------------------
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic