If you're running from the command line, try placing the file in the same directory as the .class file
ProjectRoot
bin
file.txt
program.class
src
If the program is running from eclispe, then the file should go where you originally had it. directly under the project root.
This is all considering your running the program with String filename = "file.txt";