I am try to use opencsv libray to get encrypted format data. But while writing on CSV writer I am getting \"NoClassDefFoundError\". I have seen many post related with same error
I have been struggling with getting OpenCSV set up with Maven and eclipse for a while due to exactly the same error. Ultimately I abandoned OpenCSV and used CSVParser instead, which is available from the Apache Commons and works much more readily.
Update your POM with the dependency listed here, and the following will work out-of-the-box:
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import java.io.FileReader;
import java.io.Reader;
public class importFile {
public static void main(String[] args) {
Reader in = new FileReader( csvFileInput );
CSVParser parser = new CSVParser( in, CSVFormat.DEFAULT );
List<CSVRecord> list = parser.getRecords();
for( CSVRecord row : list )
for( String entry : row )
System.out.println( entry );
}
}
The class for which it is giving error might be present in the class path but the jar which you require might have some dependencies.
Please find the link below to check the dependencies and add the dependent jars: http://opencsv.sourceforge.net/dependencies.html