How do I fix a NoSuchMethodError?

前端 未结 29 2937
孤独总比滥情好
孤独总比滥情好 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:45

    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.

提交回复
热议问题