Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    23
    Rep Power
    0

    Default FileNotFoundException

    The string i input as the filename looks like this:

    "http://avery.agron.iastate.edu/JavaBrowser/data/B2.txt"

    the console gives me back an error saying:

    File not found!
    java.io.FileNotFoundException: http:\avery.agron.iastate.edu\JavaBrowser\data\B2. txt (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.util.Scanner.<init>(Unknown Source)
    at HaploTypeBrowser.HaploTable.<init>(HaploTable.java :100)
    at HaploTypeBrowser.HaploDisplay.createGUI(HaploDispl ay.java:29)
    at HaploTypeBrowser.HaploDisplay.access$000(HaploDisp lay.java:7)
    at HaploTypeBrowser.HaploDisplay$1.run(HaploDisplay.j ava:16)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)


    Why do the slashes change when the console gives me the error? I am so confused......

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Just before line 100 of HaploTable.java use System.out.println() to output the value you are using as the file name. If it is not what you expect you have to use a debugger - or more println() statements - to find where you are changing the value from that which was input.

    In fact on Windows a filename like that is going to cause grief whichever way round the slashes go.

    A SSCCE would be very useful. But note the first "S"! Hundreds of lines of code will only obscure the problem.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Oh, it's an applet! (I've just read your other thread - and yes people dislike multiposting much more than they dislike a possibly misplaced post)

    Applets probably won't use files at all. So there is something very wrong with your use of Scanner.

  4. #4
    Join Date
    Nov 2009
    Posts
    23
    Rep Power
    0

    Default

    Hey i figured it out!! a while ago!! sorry if this was not in the right place. at the time i did not know it was a problem due to the applet.

    Yes the problem was with using File to read in the the file. Instead i had to use URL and InputStream. I finally got my applet to work!!!!!

    everyone celebrate my first working applet!!! (well if u dont count a HelloWorld Applet hahah)

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

Similar Threads

  1. filenotfoundexception :@
    By wildheart in forum New To Java
    Replies: 2
    Last Post: 04-25-2009, 09:56 AM
  2. Replies: 1
    Last Post: 04-01-2009, 07:34 PM
  3. handle FileNotFoundException
    By minifish in forum New To Java
    Replies: 13
    Last Post: 11-08-2008, 02:01 AM
  4. java.io.FileNotFoundException
    By thevoice in forum New To Java
    Replies: 5
    Last Post: 06-13-2008, 08:38 AM
  5. FileNotFoundException
    By PeonLover in forum New To Java
    Replies: 1
    Last Post: 12-26-2007, 06:15 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
  •