如何解决java.lang.NoSuchMethodError

编程入门 行业动态 更新时间:2024-10-09 04:18:11
本文介绍了如何解决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

本文发布于:2023-11-25 11:41:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何解决   java   NoSuchMethodError   lang

发布评论

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

>www.elefans.com

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