I'm trying to pull data from a text file which is in my project but under a different package. This is the layout of the project: Project Layout
When I use the path it returns an error, but when I call it via location it works correctly. I'm using Eclipse.
This is the error message I get: Error
package park.FILEMOD;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class FileModifier {
public static void main(String[] args) throws IOException{
FileReader in = new FileReader("/park_mp1/src/park/DATA/Data1.txt");
BufferedReader br = new BufferedReader(in);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
in.close();
}
}