Results 1 to 5 of 5
Thread: FileNotFoundException
- 12-29-2009, 05:58 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 23
- Rep Power
- 0
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......
- 12-29-2009, 08:06 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
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.
- 12-29-2009, 08:09 PM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
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.
- 12-29-2009, 08:29 PM #4
Member
- Join Date
- Nov 2009
- Posts
- 23
- Rep Power
- 0
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)
- 12-30-2009, 01:29 AM #5
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Similar Threads
-
filenotfoundexception :@
By wildheart in forum New To JavaReplies: 2Last Post: 04-25-2009, 09:56 AM -
java.io.FileNotFoundException: (No such file or directory)
By sudukrish in forum Advanced JavaReplies: 1Last Post: 04-01-2009, 07:34 PM -
handle FileNotFoundException
By minifish in forum New To JavaReplies: 13Last Post: 11-08-2008, 02:01 AM -
java.io.FileNotFoundException
By thevoice in forum New To JavaReplies: 5Last Post: 06-13-2008, 08:38 AM -
FileNotFoundException
By PeonLover in forum New To JavaReplies: 1Last Post: 12-26-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks