• Post Reply Bookmark Topic Watch Topic
  • New Topic

error regarding java.lang...help me  RSS feed

 
satish babus
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting a common mistake for many programs which have been copied from exampe progams of sun.java during execution, which are compiled without errors.It is as below

Exception in thread "main"java.lang.NoSuchMethodError:main
 
harish shankarnarayan
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey !!!
just check out as there is no main method included in those examples may be.

just write the main method inside the class and call and then invoke methjods in the class

Hope so this helps u..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure the class you are executing contains the main method.
If not, look for the class containing it.
If there's any doc with the examples, try to read it.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class you are trying to run must have a method called main, which should have the following method signature:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!