Results 1 to 2 of 2
  1. #1
    cachi is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Help with "new URL (getDocumentBase(),MyFileName);"

    Hi, Take a look at the following code:
    Java 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 break point 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
    Java Code:
    url=new URL (getDocumentBase(),MyFileName);
    But still no effects.
    Thanks.

  2. #2
    silvia is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default

    Checking the exception might give you a better clue:

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

Similar Threads

  1. Hwlp with "Open", "Save", "Save as..."
    By trill in forum New To Java
    Replies: 3
    Last Post: 11-02-2010, 09:26 AM
  2. Replies: 1
    Last Post: 03-14-2008, 02:51 PM
  3. Replies: 1
    Last Post: 07-27-2007, 10:59 PM
  4. Replies: 1
    Last Post: 07-25-2007, 10:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 06:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •