I am trying to use the opencsv library however I am getting stuck early on with FileReader not being able to find the csv I am using to test with.
I have the following code:
import java.io.File;
import java.io.FileReader;
public class Test {
public static void main(String[] args) {
File f = new File("demo.csv");
if(f.exists() && !f.isDirectory()) {
System.out.println("File exists");
}
else {
System.out.println("File does not exist");
}
FileReader reader = new FileReader("demo.csv");
}
}
I am getting a FileNotFoundException error on the FileReader:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Unhandled exception type FileNotFoundException at Test.main(Test.java:19)
despite having checked the file exists in the correct directory using f.exist. Done a load of searching and found nothing to explain it.
Can anyone help with this?