java.lang.NoClassDefFoundError:org / apache / commons / lang3 / ObjectUtils [英] java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils
问题描述
我正在尝试编写程序来读取CSV文件,然后用它来制作一些东西。
我经常搜索,最后我发现了这个库。
I'm trying to code a program to read a CSV file and then make some stuff with it. I've searching a lot, and finally I found out this library.
前几天我完成了代码,一切正常。今天我将库更新到4.0 v,然后弹出了很多警告。
Some days ago I finished the code, and everything worked fine. Today I updated the library to the 4.0 v, and then a lot of warnings popped out.
我做了一些测试,失败的部分是:
I made some testing and the part that fails is:
public void LeerCSV(File CSVCat, File CSVProd){
//Creo un objeto de la clase FileReader que me hace falta para los CSVReader
CSVReaderBuilder lectorCatBuilder = null;
CSVReaderBuilder lectorProdBuilder = null;
CSVReader CatReader = null;
CSVReader ProdReader = null;
CSVParser CatParser = null;
CSVParser ProdParser = null;
//Vamos a intentar abrirlos y operar con ellos
try {
//Se crea una especie de "constructor" para crear los lectores de archivos.
//para ello, antes se le pasan todos los atributos que queramos
CatParser =
new CSVParserBuilder()
.withSeparator(SEPARADOR)
.withIgnoreQuotations(true)
.build();
CatReader =
new CSVReaderBuilder(new FileReader(CSVCat))
.withSkipLines(1)
.withCSVParser(CatParser)
.build();
ProdParser =
new CSVParserBuilder()
.withSeparator(SEPARADOR)
.withIgnoreQuotations(true)
.build();
ProdReader =
new CSVReaderBuilder(new FileReader(CSVProd))
.withSkipLines(1)
.withCSVParser(ProdParser)
.build();
这一个。
警告是:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/apache/commons/lang3/ObjectUtils
at com.opencsv.CSVParser.<init>(CSVParser.java:207)
at com.opencsv.CSVParserBuilder.build(CSVParserBuilder.java:138)
...
...
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.lang3.ObjectUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
这个。
我知道这是一个库问题,但我不知道是什么库导致它,或者我是否需要更新或安装某些东西。
I know that is a library problem but I don't know what library is causing it, or if I need to update or install something.
非常感谢。
推荐答案
您似乎没有使用apache commons lang3库: https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
It's seem that you are not using apache commons lang3 library : https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
这篇关于java.lang.NoClassDefFoundError:org / apache / commons / lang3 / ObjectUtils的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!