ClassNotFoundException的,即使含有JAR是构建的一部分 [英] ClassNotFoundException, even though the containing JAR is part of the build

查看:151
本文介绍了ClassNotFoundException的,即使含有JAR是构建的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个的ClassNotFoundException 上一个类( HSSFWorkbook )包含在包含在一个JAR我的身材。

I am getting a ClassNotFoundException on a class (HSSFWorkbook) that is included in a JAR that is included in my build. The JAR is listed in this list (I am using Eclipse):

Project -> Properties -> Java Build Path -> Libraries

我曾尝试删除,然后重新添加,无果。

I have tried removing and adding it again, to no avail.

我的code是如下:

// ...
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
// ...

public class XLSWorkbook {
    private HSSFWorkbook wb = null;

    // ...
    public XLSWorkbook() {
        wb = new HSSFWorkbook();
    }
}

当我尝试实例化 XLSWorkbook 类的异常。我使用的jar Apache的 POI库(是precise:POI-3.8-20120326的.jar)。

And the exception is thrown when I try to instantiate the XLSWorkbook class. The JAR I am using is the POI library from Apache (to be precise: poi-3.8-20120326.jar).

推荐答案

由于 ADT-18 (我不知道的版本),外部JAR库并没有被明确纳入。你应该把它放在文件夹内。 ADT将提供进口他们为你。所以,你应该删除库项目 - >属性 - > Java构建路径 - >库

Since ADT-18 (I am not sure about the version), external jar libraries have not to be included explicitly. You should put it inside the libs folder . ADT will provide to import they for you. So you should remove the libraries from Project -> Properties -> Java Build Path -> Libraries

这篇关于ClassNotFoundException的,即使含有JAR是构建的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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