Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread  RSS feed

 
Brian Wilson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be a very basic question even for a beginner but here goes anyway.
I compiled a simple program which compiled alright but when I run it I get
"Excetion in thread "main" java.lang.NoSuchMethodError:main" What does this mean?
 
Rikko Verrijzer
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It means that the jvm could not find your main method. Check if your main signature is correct. it should look like

Also check if your main method is in the class you are executing.
Hope this helps.
Rikko
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian
The possible causes for these kinds of errors amongst others are :
1. Wrong class name. java abc is different from java ABC
2. See if you are executing a file that contains the main() method. A file without a main method would compile but will not execute.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!