【发布时间】:2014-04-22 22:34:25
【问题描述】:
我在 jar 中有以下类
public class Loc {
public static class Dat {
private int x, y;
public Dat(int x, int y) {
this.x = x;
this.y = y;
}
}
}
在另一个项目中,我正在像这样实例化上面的类:(我正在导入上面的类)
Loc.Dat data = new Loc.Dat(19,10);
但我在日志中看到以下错误。 (不在 tomcat 服务器控制台中显示)
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/myservice]
threw exception [Handler processing failed; nested exception is
java.lang.NoClassDefFoundError: org/company/manage/serv/Loc$Dat]
with root cause
java.lang.ClassNotFoundException: org.company.manage.serv.Loc$Dat
我进入 WebApps 文件夹并打开了 jar 文件。我看到了 Loc 和 Loc$Dat 类文件。
我错过了什么?
编辑: 我忘了说这编译得很好。没有显示错误。它仅在我运行时显示。
【问题讨论】:
标签: java static classnotfoundexception inner-classes