Eclipse在运行时抛出ExceptionInInitializerError,在调试时抛出NoClassDefFoundError

编程入门 行业动态 更新时间:2024-10-26 02:26:52
本文介绍了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

本文发布于:2023-11-06 04:00:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562674.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:抛出   Eclipse   NoClassDefFoundError   ExceptionInInitializerError

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!