Your file should be located directly under the project folder, and not inside any other subfolder.
So, if your project folder is MyProject , the folder structure (not full) should look like this: -
MyProject +- src + | | | +
It should not be a folder under src .
Or you can specify the following path relative to the project folder to search for a file in src folder : -
new File("src/file.txt");
source share