| Author |
java.lang.NoSuchMethodError
|
Sona Patel
Ranch Hand
Joined: Mar 30, 2009
Posts: 75
|
|
Hi All..
I have two classes. First class has two static methods. Second class is calling one of the static methods from first class without creating instance.
Both the classes compiled without errors. But while running second class i am getting "java.lang.NoSuchMethodError" where i am calling static method of first class.
Everything seems fine. No compile time error. Then what can be the reason of this runtime error.
Thanks
|
 |
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3090
|
|
We need more information:
1) The exact (copy and paste) of the error you get. Likely this will tell you exactly what the problem is
2) The lines of code that cause the error (you can get the location of the error from the stack trace the error give you.
|
Steve
|
 |
Sona Patel
Ranch Hand
Joined: Mar 30, 2009
Posts: 75
|
|
I can not copy paste exact code but below is the snap shot of it
Classes are as below
|
 |
swati aole
Greenhorn
Joined: May 02, 2009
Posts: 9
|
|
Sona Patel wrote:I can not copy paste exact code but below is the snap shot of it
Classes are as below
I think the java.lang.NoSuchMethodError is thrown because the interpreter is trying to find main() which you'ven't provided..
|
 |
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3090
|
|
|
It could be that there is no public static void main(String[] args) to be executed. Sona, instead of making us guess, could you please copy and paste the error message that you get?
|
 |
Sona Patel
Ranch Hand
Joined: Mar 30, 2009
Posts: 75
|
|
Issue Resolved...
Thank you friends
It was referring to old class file somehow , which did not have newly added method. and hense "NoSuchMethodError"
So i changed the class file with new one and its working now...
thanks for your suggestions...
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
Did you read the API documentation first? That would have been very helpful.
|
 |
 |
|
|
subject: java.lang.NoSuchMethodError
|
|
|