Forums Register Login

Exception in thread "main" java.lang.NoSuchMethodError: main

+Pie Number of slices to send: Send
I have no idea why it's giving me

Exception in thread "main" java.lang.NoSuchMethodError: main

this, could someone explain?

[ July 22, 2008: Message edited by: Logan Knecht ]
+Pie Number of slices to send: Send
The main method is recognized as the entry point for an application only if it's defined as "public static void main (String[] args)". You can't redefine the type of the parameters to be something else.
+Pie Number of slices to send: Send
Okay I understand what you're saying about having to have string args[] as the starting point, is there a way to set the starting point?
[ July 22, 2008: Message edited by: Logan Knecht ]
+Pie Number of slices to send: Send
No. That's hardwired into the "java.exe" executable.
+Pie Number of slices to send: Send
I think there is no need to set the starting point
You can just use the main method ,
use the String arguments
and convert them to ints and get your work done




Hope this helps
+Pie Number of slices to send: Send
That little example won't compile. You would have to call
. . . testSum(Integer.parseInt(args[0]), . . .

That is prone to a NumberFormatException or an ArrayOutOfBoundsException if you don't pass two integers as command-line arguments . . .

java Parameters 123 456

would work.
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5952 times.
Similar Threads
Value of hexadecimal 0xDeadCafe
x++ , ++x
question about variables changed inside methods
This code tells me i don't have a main()
Plot update error - JMathPlot
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:19:17.