Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

URL connection UnknownhostException problem

  Date: Nov 24    Category: Java    Views: 409
  

Can any one help me in this problem ?

I have created an URL to get the information from some site say as
"WWW.SiteName.com"

Program is,

import java.net.*;
import java.io.*;
import java.util.Date;
class UCDemo
{
public static void main(String args[]) throws Exception
{
URL hp = new URL("http://www.SiteName.com/");
URLConnection hpCon = yahoo.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
hpCon.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}

I am getting the UnknownhostException turned on though my computer is connected to
the net.
But when i am accessing the intrnal site i not getting any error message,so
how can i avoid the exception for the external sites avoiding this error.Can any one
please give the complete detailed information on this to me immediately.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on URL connection UnknownhostException problem Or get search suggestion and latest updates.