java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFile 傷城~ 2023-10-13 17:43 10阅读 0赞 ### 一,错误: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFile ### > 实现java代码导入导出Excel表格请参考[导入excel代码][excel](https://blog.csdn.net/laterstage/article/details/131713449?spm=1001.2014.3001.5501) 错误原因:缺少对应的commons-compress-1.18.jar,在项目添加该包后问题解决 > 解决方式:引入jar包 1. 传统java项目,将commons-compress-1.18.jar添加到依赖里面 2. maven项目引入下面依赖 <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> <version>1.18</version> </dependency> > 如果以上问题没有解决,将下面pom依赖进行版本对照。 <!-- 下面两个依赖是实现 导入excel的--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.0</version> </dependency> <!-- 下面依赖是实现 导出excel的--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>4.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> <version>1.18</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math3</artifactId> <version>3.6.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math3</artifactId> <version>3.6.1</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>3.1.0</version> </dependency> [excel]: https://blog.csdn.net/laterstage/article/details/131713449?spm=1001.2014.3001.5501
还没有评论,来说两句吧...