File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Garrett Nickel
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm using the Head First: Java 2nd Edition book, and following the instructions for making and testing Movie objects.

my code is :

I am very new to Java, and I have no clue why I am getting "Exception in thread "main" java.lang.NoSuchMethodError: main" even though javac successfully compiles it.

Please help
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What command are you using to run your program? You should be doing something like:

java MovieTestDrive

You have to use the name of the class that your main method is in when using the "java" command...NOT the name of your source code file.
 
Garrett Nickel
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael, it works now!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic