0

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?

6
  • 2
    Please include you pom or gradle as this probably is a dependency issue. Commented Nov 11, 2021 at 5:54
  • 1
    You need it on your runtime classpath as well. Commented Nov 11, 2021 at 5:55
  • 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. Commented Nov 11, 2021 at 9:00
  • Adding the apache-commons-lang3 jar to the classpath solved my problem, thank you Commented Nov 11, 2021 at 19:52
  • Consider adding the solution as an answer and accept it so that the question can be "closed" and others might benefit from it. Thanks! Commented Nov 11, 2021 at 22:25

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.