Eclipse在运行时抛出ExceptionInInitializerError,在调试时抛出NoClassDefFoundError [英] Eclipse throws ExceptionInInitializerError on run , NoClassDefFoundError on debug

查看:219
本文介绍了Eclipse在运行时抛出ExceptionInInitializerError,在调试时抛出NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

项目A取决于项目B.

在编译时,一切正常.

在调试时,从项目B的类bClass调用静态函数时,出现NoClassDefFoundError.

On debug , when a static function from class bClass of project B is called , I get NoClassDefFoundError .

在运行时,出现ExceptionInInitializerError.

On run , I get ExceptionInInitializerError.

此外,bClass有一个静态初始化程序,当我在其中放置一个断点时,它永远不会到达断点-这在我看来很奇怪,但也很有意义,因为可能找不到该类.

Besides , the bClass has a static initializer , and when I put a break point there , it never reaches it - which seems very strange to me , but also makes sense because the class is probably not found.

任何想法如何解决?据我所知,我已经检查了所有依赖项.

Any idea how to fix? I've checked all dependencies to the best of my understanding.

推荐答案

对于NoClassDefFound异常,请对照编译时类路径再次检查运行时类路径. Eclipse通常为运行时CP使用编译时类路径,但是如果您修改了默认的启动配置,则它们可能不再匹配.

In the case of NoClassDefFound exceptions, double check your runtime classpath against your compiletime classpath. Eclipse usually uses the compile-time classpath for the runtime CP but if you have modified the default launch config, they may not match anymore.

这篇关于Eclipse在运行时抛出ExceptionInInitializerError,在调试时抛出NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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