I am trying to read a file from the source folder, both the java file and text files are same location but program shows FileNotFoundException
Where should i put input file so program can find it?
I am trying to read a file from the source folder, both the java file and text files are same location but program shows FileNotFoundException
Where should i put input file so program can find it?
Either you have to use absolute path or put you text file in root folder. In your case put your txt file in BasicIO
.
Have you tried this? FileInputStream("hello.txt"), doesn't work unless I specify an absolute path (C:\User\Documents etc) Instantiate a File object with relative path ./name.txt e.g.:
File file = new File("./myfile.txt");
Make sure myfile.txt is in the root project folder.