Creating a file object only works when I use an absolute path

27 views Asked by At

I want to let the user input the file name, and be able to read through that file. I then get the error that the file is not found. The file is in the same module, and I want it to work without having to specify the absolute path. I am using Intellij.

This is what I want, but I get a FileNotFoundException.

File dataFile = new File("lottacash.csv");

This is the way I got it to work.

File dataFile = new File("C:\\FolderWithModuels\\ModuelProject\\"+ "lottacash.csv");
0

There are 0 answers