Reputation: 61
I am trying to import the openCSV class into my Java project. I am using VS code with no build tools I has have not yet learned Maven. I am attempting to import the class in the same way as shown in the tutorial provided by VS code: (https://code.visualstudio.com/docs/java/java-project#_library-configuration)
And in my .vscode\settings.json
file, the path to the .jar
file appears. However when I run code that uses the module, the following error occurs:
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 App.main(App.java:9)
The error occurs at the line where I initialize a CSVReader class
What is causing this error and do I fix it?
Many thanks for your time,
Upvotes: 0
Views: 459
Reputation: 4296
That's because OpenCSV has dependencies. In the above case on Commons Lang. You need to meet them all. Learn Maven! Your alternative is to keep finding dependencies manually and meeting them until no more errors.
Upvotes: 1