Java “NoSuchMethodError”

后端 未结 7 535
天涯浪人
天涯浪人 2020-12-20 11:02

I\'m getting:

NoSuchMethodError: com.foo.SomeService.doSmth()Z

Am I understanding correctly that this \'Z\' means that return

7条回答
  •  隐瞒了意图╮
    2020-12-20 11:23

    The current reply just tell you why is failing. Usually is even nicer to know how to fix problems. As it is mentioned, the problem usually is that you built your program but when running or exporting it, the library is not included. So the solution is...

    If you are running, check the the run configuration Select Run tab -> Run configurations -> Select the configuration you are running -> Check the Classpath tab -> Ensure the libraries you need are there

    If you are exporting (for example a war file), follow this Select project -> Select properties -> Select Deployment Assembly -> Press Add -> Select Java Build Path Entries -> Select the libraries you want to be included in your exported file (for example a war file)

    In both cases, ensure the library which you are referencing in included.

    Other frequent problems for this error are not the right type of parameters or visibility but then, the compiler will detect the error before running. In this case, just check the documentation to match the function and package visibility, and ensure that the library is found in Java Build Path in your project properties.

提交回复
热议问题