SyntaxFix
Write A Post
Hire A Developer
Questions
Have you tried using an absolute path:
File file = new File(System.getProperty("user.dir") + "/file.txt");