Sorry for asking such a noob question. I've tried multiple things. All the examples I see online are what I tried in (1) and it isn't working.
String source= "C:\\temp\\data.csv"; CSVReader csvreader= new CSVReader(new FileReader(csv),",");
The above code gives the error "Constuctor CSVReader(FileReader, String) is not defined", but I've seen this used online. I think it is deprecated but can't I still use it? I checked the documentation and tried to use the constructor shown there in (2).
String source = "C:\temp\data.csv";
Reader reader = new FileReader(source); CSVReader csvreader= new CSVReader(reader);
Gives the error:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/lang3/ObjectUtils at
> com.opencsv.CSVParser.<init>(CSVParser.java:99) at
> com.opencsv.CSVReader.<init>(CSVReader.java:99) at
> csvpractice.main(csvpractice.java:54) Caused by:
> java.lang.ClassNotFoundException: org.apache.commons.lang3.ObjectUtils
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
> at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
> ... 3 more