Results 1 to 5 of 5
Thread: java.io.FileNotFoundException
- 08-18-2011, 12:10 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
java.io.FileNotFoundException
Hi All,
I'm getting the below error when I tried to read a simple abc.txt file by using the attached javacode.
My Classpath is set as %CLASSPATH%;.; and the abc.txt,javacode are placed in the same folder.I'm getting an error during runtime.
Can any one please help me how to overcome this problem.

Exception in thread "main" java.io.FileNotFoundException: abc.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.jav a:120)
at java.io.FileInputStream.<init>(FileInputStream.jav a:79)
at copystream.main(copystream.java:10)
Java Result: 1
- 08-18-2011, 12:27 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Try:
at the top of your method to find out where it's using as its base directory.Java Code:File inFile = new File("abc.txt"); System.out.println(inFile.getAbsolutePath());
Since you're in an IDE it's likely to be the top of the project, not the src directory (which is what the one I'm using at the moment does).
- 08-18-2011, 01:35 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
Hi Tolls,
I tried the thing which you mentioned above but still it's throwing the same error.
Please help me out.
- 08-18-2011, 02:06 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
That wasn't supposed to fix it.
It was supposed to tell you where it was looking for the file...
- 08-18-2011, 02:06 PM #5
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
java.io.FileNotFoundException: \temp\env.out
By JJones in forum New To JavaReplies: 3Last Post: 05-19-2011, 11:07 PM -
Java.util.zip FileNotFoundException
By deredowl in forum Advanced JavaReplies: 4Last Post: 05-18-2011, 09:37 AM -
java.io.FileNotFoundException: http://192.168.1.101:80/abc
By ethical in forum New To JavaReplies: 1Last Post: 04-14-2011, 05:04 AM -
java.io.FileNotFoundException: (No such file or directory)
By sudukrish in forum Advanced JavaReplies: 1Last Post: 04-01-2009, 07:34 PM -
java.io.FileNotFoundException
By thevoice in forum New To JavaReplies: 5Last Post: 06-13-2008, 08:38 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks