I am trying to open a txt file in a java program and the compiler keeps advice me throwing the error, that is responsible for the program crash:
FileNotFoundException
I am working on intelliJ
and the file is in the same directory I am working on, it is in the src
directory.
The file is called dataset.txt and I tried all of the below formats to solve the issue.
BufferedReader br = new BufferedReader(new FileReader("D:\\Mhamed\\Courses\\Algorithms Specialization\\Course 1\\Week 2\\src\\dataset.txt"));
BufferedReader br = new BufferedReader(new FileReader("dataset.txt"));
BufferedReader br = new BufferedReader(new FileReader("/dataset.txt"));
BufferedReader br = new BufferedReader(new FileReader("./dataset.txt"));
BufferedReader br = new BufferedReader(new FileReader("src\\dataset.txt"));
BufferedReader br = new BufferedReader(new FileReader("D:/Mhamed/Courses/Algorithms Specialization/Course 1/Week 2/src/dataset.txt"));
Finally, nothing works and I don't know what is the issue. Can someone help me?