Java异常: Found interface … but class was expected

刺骨的言语ヽ痛彻心扉 2022-05-31 02:41 887阅读 0赞

This happens when your runtime classpath is different than your compile time classpath.

这个异常是由于你的运行时classpath和编译时classpath 不一致。

When your application was compiled, a class (named SomeInterface in your question) existed as a class.

When your application is running at compile time, SomeInterface exists as an interface (instead of a class.)

当你的应用编译时,一个叫SomeInterface 的类以类的形式存在;但是当应用编译运行时,SomeInterface 却以接口的形式出现(而不是类的形式)

This causes an IncompatibleClassChangeError to be thrown at runtime.

这会导致运行时抛出IncompatibleClassChangeError 异常。

This is a common occurence if you had a different version of a jar file on the compile time classpath than on the runtime classpath.

当jar包在编译时 classpath和运行时classpath中是不同版本,就经常会出现这个问题。

总结:jar包版本冲突

发表评论

表情:
评论列表 (有 0 条评论,887人围观)

还没有评论,来说两句吧...

相关阅读