Re: Input/Output program Compiles but doesn't run
- From: "Carl" <c.groner@xxxxxxxxx>
- Date: 30 Mar 2006 10:21:20 -0800
janicethorne via JavaKB.com wrote:
Can anyone help me with this error? I have included the code after the
explaination.
This code uses the rectangle class (which I just included in the code,
although I was supposed to import it). The code should take in values from
the user, calculate them using the methods stored in the rectangle class, and
display them in the GUI. I was able to get my code to compile, but when it
runs, I get "Exception in thread "main" java.lang.NoSuchMethodError: main. I
have been over and over the code. I can't see what I'm doing wrong. If you
can help in any way, I would really appreciate it. I think I included
everything I was supposed to, but I am a beginner and can't always tell if I
need more. Any help will be appreciated. thank you.
The java main method with the signature
public static void main(String[] args)
is special and will be used to start the application. You have not
declared this method, hence the "NoSuchMethodError: main" error; the
main method with this _exact_ signature cannot be found.
You have declared an instance method with the signature
main(String[] args).
Note that simply adding the static modifier to your main method will
not work as your main method references non static instance variables.
Hope that helps,
Carl.
.
- Follow-Ups:
- Re: Input/Output program Compiles but doesn't run
- From: janicethorne via JavaKB.com
- Re: Input/Output program Compiles but doesn't run
- References:
- Input/Output program Compiles but doesn't run
- From: janicethorne via JavaKB.com
- Input/Output program Compiles but doesn't run
- Prev by Date: Re: integers and arrays inJava - how?
- Next by Date: File IO -- Reading Config Files Easily
- Previous by thread: Re: Input/Output program Compiles but doesn't run
- Next by thread: Re: Input/Output program Compiles but doesn't run
- Index(es):