如何解决java.lang.NoSuchMethodError [英] How to resolve java.lang.NoSuchMethodError

查看:173
本文介绍了如何解决java.lang.NoSuchMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在Eclipse中正常运行的项目,但是运行独立的jar将在运行时为类提供java.lang.NoSuchMethodError.

I have a project that I can run correctly from within Eclipse, but running the standalone jar gives me the java.lang.NoSuchMethodError for a class at runtime.

我解压缩了jar文件,并且可以在jar中的一个库文件中看到类文件,并且确实看到了在类中定义的方法.唯一的例外不是找不到类,而是在类中找不到方法.

I unpacked the jar file and can see the class file in one library file in jar and I do see the method defined in the class. The exception is not about class not found, but just can't find the method in the class.

在互联网上找不到任何有用的信息来解决该问题.

Could not find any helpful information on the internet for how to solve it.

推荐答案

很有可能在依赖项中还有另一个jar具有相同的类(可能是同一库的另一个版本),但是没有这个方法.我认为后一类是加载的类,而不是您解压缩的类.

It is much likely that there is another jar in the dependencies that has the same class(may be another version for the same library) but don't have this method. I think that this latter class is the one loaded instead of the one you unpacked.

这篇关于如何解决java.lang.NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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