Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils

Here is the code

public static void readCSV() {
    String inputFile = "memberInfo1.csv";
    try {

        // Create an object of filereader
        // class with CSV file as a parameter.
        FileReader filereader = new FileReader(inputFile);

        // create csvReader object passing
        // file reader as a parameter
        CSVReader csvReader = new CSVReader(filereader);
        String[] nextRecord;

        // we are going to read data line by line
        while ((nextRecord = csvReader.readNext()) != null) {
            for (String cell : nextRecord) {
                System.out.print(cell + "\t");
            }
            System.out.println();
        }
        csvReader.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

The error that I am receiving is pictured here I already added the opencsv-5.5.2. jar to the classpath pictured here I am running Java 11.0.12 installed through homebrew. Is there another step that I am missing?

Upvotes: 0

Views: 1354

Answers (1)

Ethan
Ethan

Reputation: 146

the error message was indicated that org.apache.commons.lang3.ObjectUtils can not be found. So you need add the apache commons-lang3 jar to the class path.

Upvotes: 1

Related Questions