Apache POI 错误加载 XSSFWorkbook 类 [英] Apache POI error loading XSSFWorkbook class

查看:67
本文介绍了Apache POI 错误加载 XSSFWorkbook 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个适用于 Excel 文档的程序,但 HSSF 格式对于我的要求来说太小了.我正在尝试改用 XSSF,但在尝试使用它时总是出错.

I'm trying to write a program that works with Excel docs, but the HSSF format is too small for my requirements. I'm attempting to move to XSSF, but I keep getting errors when trying to use it.

我通过在我的程序中添加 xmlbeans-2.3.0.jar 和 dom4j-1.6.jar 设法解决了前两个问题,但是现在出现了这个错误,这似乎并没有通过添加 Apache commons 来解决Apache 网站上提供的 jar.

I managed to solve the first two by adding xmlbeans-2.3.0.jar and dom4j-1.6.jar to my program, but now this error is coming up, which doesn't seem to be resolved by adding the Apache commons jar available on the Apache website.

错误如下:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap
    at hot.memes.ExcelCreator.main(ExcelCreator.java:66)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

推荐答案

在您的构建路径中添加 commons-collections4-x.x.jar 文件并重试.它会起作用.

Add commons-collections4-x.x.jar file in your build path and try it again. It will work.

您可以从 https://mvnrepository.com/artifact/org.apache 下载它.commons/commons-collections4/4.0

这篇关于Apache POI 错误加载 XSSFWorkbook 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆