Results 1 to 5 of 5
Thread: data.txt not found
- 04-23-2009, 01:43 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 5
- Rep Power
- 0
data.txt not found
Hi,
I hope some can help me out with this.
I have a program and it runs fine from the Command Prompt using javac then running it. The program holds some data in a .txt file.
I have put the code into Eclipse, but I do not know how/where to add the txt file to the program. The debugger keeps saying file not found even though it is within the same 'src>default package' folder.
I keep reading I have to make it into a .jar file before I can include it, but then I read you cannot use them in this form.
So how can I add the data.txt file into the program/IDE?
Million thanks for any help, I am quite stuck and under pressure. :o
Thank you
- 04-23-2009, 01:55 AM #2
Make sure eclipse is set to copy resources from the src folder to the bin (output) folder.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-23-2009, 02:15 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 5
- Rep Power
- 0
Thanks OrangeDog!!!!
How is that done?
Set eclipse to copy resources to that?
I right click on the src folder, but see no option for that.
+Rep
Please help :)
EDIT - I have deleted the txt file fom the project and have a new one to add and try again.
I right click on the 'src' folder in the Package Explorer window. I go New>File and enter a name 'mydata.txt' which is placed in the 'src' folder and I click OK. Copy and paster the files contents into the file, save, and try to run, but it says:
File not found: mydata.txt
EXCEPTION: books.txt (The system cannot find the file specified)
java.io.FileNotFoundException: books.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)Last edited by RedSix; 04-23-2009 at 02:30 AM.
- 04-23-2009, 03:11 AM #4
I think it's on by default, I can't find the settings right now. Can you confirm that it is being copied to the output folder?
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-23-2009, 03:43 AM #5
Member
- Join Date
- Apr 2009
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
No JVM found error
By rocky05 in forum New To JavaReplies: 1Last Post: 01-27-2009, 04:41 PM -
no jre,jvm found error
By rocky05 in forum EclipseReplies: 2Last Post: 01-27-2009, 04:38 PM -
Web Application not found
By adtd8 in forum JavaServer Pages (JSP) and JSTLReplies: 7Last Post: 07-28-2008, 03:05 AM -
GeoPoint Not found
By nvidia in forum NetBeansReplies: 2Last Post: 05-28-2008, 10:31 PM -
404 Not Found
By mary in forum Java ServletReplies: 5Last Post: 11-07-2007, 11:15 AM
Bookmarks