How do I fix a NoSuchMethodError?

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

    I've had the same problem. This is also caused when there is an ambiguity in classes. My program was trying to invoke a method which was present in two JAR files present in the same location / class path. Delete one JAR file or execute your code such that only one JAR file is used. Check that you are not using same JAR or different versions of the same JAR that contain the same class.

    DISP_E_EXCEPTION [step] [] [Z-JAVA-105 Java exception java.lang.NoSuchMethodError(com.example.yourmethod)]

提交回复
热议问题