How do I fix a NoSuchMethodError?

2018-12-31 01:41发布

I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?

25条回答
裙下三千臣
2楼-- · 2018-12-31 02:32

To answer the original question. According to java docs here:

"NoSuchMethodError" Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

  1. If it happens in the run time, check the class containing the method is in class path.
  2. Check if you have added new version of JAR and the method is compatible.
查看更多
登录 后发表回答