Mar 21, 2012 2:17 pm
William CollsI think this is really an Eclipse problem.
When I try to run my program, I get the error message
NoSuchMethodFound: main
The file does in fact contain a main method, declared as public static
void, with no arguments.
I suspect that Eclipse is looking in the wrong place for the method, but
in every place that I can find in the various configurations, the file
that I am running is identified as the file containing containing the
main() method.
Any suggestions as to where further to look will greatfully received.
Thanks for your time.
William.
Mar 21, 2012 2:41 pm
Jussi PiitulainenWilliam Colls writes:
> I think this is really an Eclipse problem.
>
> When I try to run my program, I get the error message
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
>
> When I try to run my program, I get the error message
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
Have you tried declaring it correctly?
Either: public static void main(String[] args)
or: public static void main(String... args).
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.1.4>
Mar 21, 2012 3:18 pm
MarkspaceOn 3/21/2012 7:17 AM, William Colls wrote:
> I think this is really an Eclipse problem.
>
> When I try to run my program, I get the error message
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
>
> When I try to run my program, I get the error message
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
No arguments? In Java, the signature must match exactly. The argument
declaration is required.
Mar 21, 2012 8:41 pm
LewWilliam Colls wrote:
> I think this is really an Eclipse problem.
Nope.
> When I try to run my program, I get the error message
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
>
> NoSuchMethodFound: main
>
> The file does in fact contain a main method, declared as public static
> void, with no arguments.
It's a programmer problem.
> I suspect that Eclipse is looking in the wrong place for the method, but
> in every place that I can find in the various configurations, the file
> that I am running is identified as the file containing containing the
> main() method.
>
> Any suggestions as to where further to look will greatfully [sic] received.
> in every place that I can find in the various configurations, the file
> that I am running is identified as the file containing containing the
> main() method.
>
> Any suggestions as to where further to look will greatfully [sic] received.
Jussi and markspace explained the problem.
I will generalize the answer for you:
Do not suspect Eclipse first. Do not suspect Java first. Always suspect the programmer first.
Lew
Previous Thread: Fourier transform
Next Thread: Absolute beginner question