I have a problem in Eclipse Java where I got an error that is "source not found".
May I know what is the error as I have checked that the path, and it seems correct however when I run the program, it terminated.
String Path = new File("").getAbsolutePath();
FileReader csvFile = new FileReader(Path+"/src/login_sessions.csv");
Thanks a lot.
Try this:
File csvFile = new File("src/login_sessions.csv");
System.out.println("opening file at " + csvFile.getAbsolutePath());
try (FileReader reader = new FileReader(csvFile)) {
// do your thing
}
Does the path it outputs match what you expect? It may be executed at a location you don't expect.
try this :
File f;
f = new File(getClass().getResource("/mockJson.json").getFile());
FileReader csvFile = new FileReader(f);
mockJson.json stored in src
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.