...

View Full Version : read file Java



alaios
05-10-2004, 07:22 AM
Take a look at the following code:
try{

url=new URL ("http://www.ora.com/images/logo.jpg");
InputStream in = null;
in=url.openStream();
BufferedReader bf = null;
bf=new BufferedReader(new java.io.InputStreamReader(in));
theString=bf.readLine();
}catch(Exception e){
System.out.println("Something is wrong");
}

I have put a breakpoint at the first line (url=new...). I have noticed that at execution time an exception occurs "Something is wrong"-->message.
What is wrong with it?
I have also tried the
url=new URL (getDocumentBase(),MyFileName);
but still no effects

shmoove
05-10-2004, 08:36 AM
Checking the exception might give you a better clue:


// ...
catch (Exception e) {
System.out.println("Something is wrong - " + e);
e.printStackTrace();
}


shmoove



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum