Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-10-2004, 07:22 AM   PM User | #1
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 433
Thanks: 3
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
read file Java

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
alaios is offline   Reply With Quote
Old 05-10-2004, 08:36 AM   PM User | #2
shmoove
Regular Coder

 
Join Date: Dec 2003
Posts: 367
Thanks: 0
Thanked 0 Times in 0 Posts
shmoove is an unknown quantity at this point
Checking the exception might give you a better clue:
Code:
// ...
catch (Exception e) {
  System.out.println("Something is wrong - " + e);
  e.printStackTrace();
}
shmoove
shmoove is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 AM.


Advertisement
Log in to turn off these ads.