FileNotFoundException


I have written a client class which reads data from a structured text file, then instantiates a record object and adds it to an ArrayList. The structured file with a .txt file extension was created within the project node. The code compiles, but causes a FileNotFound exception at run time, i.e., the text file cannot be found. I am a new IntelliJ IDEA 4.5 user and this may be a configuration or classpath problem, stemming from my own ignorance.

Any recommendations will be greatly appreciated.

Thanks you,
dh

2 comments
Comment actions Permalink

Doane Hulick wrote:

I have written a client class which reads data from a structured text file, then instantiates a record object and adds it to an ArrayList. The structured file with a .txt file extension was created within the project node. The code compiles, but causes a FileNotFound exception at run time, i.e., the text file cannot be found. I am a new IntelliJ IDEA 4.5 user and this may be a configuration or classpath problem, stemming from my own ignorance.


If you are using a relative path to the file, check which directory your
application is running from (i.e. it's "working directory"). You can set
the working directory in IDEA's Run configuration.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

Another thing that you could try:

In the settings for Project | Compiler, add *.txt to the "Resource
patterns:"

This way the txt file will get copied to the 'output' dir.

0

Please sign in to leave a comment.