Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception error

 
chelle agno
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was compiling my project and it did compile but when i', excute it says exceptionerror thread in main what this really mean? thanks
 
rom chatterjee
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the whole error message
 
Dorothy Finkel-Laverty
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd bet it says "Exception in thread main java.lang.NoSuchMethodError: main". What it means is that your program did not have a main method with the proper signature - like "public static void main(String [ ] args)".
You want to learn to read these exceptions - they really point you to the solution. For example, when you run a console application, it MUST have a main method. That is the starting point for execution. If it does not have a main method that matches the signature (is named main and takes an array of Strings as the input argument), and even does not return nothing (void), it won't know where to start. The next part, "java.lang.NoSuchMethodError" tells you that the problem is in the java.lang package, and it couldn't find the method main (see it after the colon?).
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic