How do I fix a NoSuchMethodError?

前端 未结 29 2924
孤独总比滥情好
孤独总比滥情好 2020-11-21 05:08

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

29条回答
  •  忘了有多久
    2020-11-21 05:44

    This is usually caused when using a build system like Apache Ant that only compiles java files when the java file is newer than the class file. If a method signature changes and classes were using the old version things may not be compiled correctly. The usual fix is to do a full rebuild (usually "ant clean" then "ant").

    Sometimes this can also be caused when compiling against one version of a library but running against a different version.

提交回复
热议问题