File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in program

 
jose chiramal
Ranch Hand
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it gives me an error : java.lang.NoSuchMethodError: main
Exception in thread "main" . Anything wrong ?

Edited again: Please use code tags only for the code, not expository text.
 
Peter Taucher
Ranch Hand
Posts: 174
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all: What kind of difficulties / error are we talking about. Is it a compiler error, or an error at runtime?
Second: Use code tags
Third: Check your blocks / braces. I think there's one closing bracket missing.

// Edit. OK, forget about the code tags ; - )
 
W. Joe Smith
Ranch Hand
Posts: 710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have your main method inside of your demoproc() method. I'm not sure you can do that.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4116
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure you can do that.
Yep, you cannot.

Ps - Indenting the code properly makes the life easy.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is your code properly formatted:


From that, it's easy to see you have a method (main) defined inside the demoproc method. You can't do that. Methods cannot be nested inside each other in java.
 
Jim Hoglund
Ranch Hand
Posts: 525
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is well worth the effort to pay attention to proper indenting.
If you do, this kind of problem just does not happen.

Jim ... ...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic