*
The moose likes Beginning Java and the fly likes Help - Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help - Exception " Watch "Help - Exception " New topic
Author

Help - Exception

Socrates Farias de Barros
Greenhorn

Joined: Feb 27, 2009
Posts: 2

This is the error
Exception in thread "main" java.lang.NoSuchMethodError: main

Party.java program in my book Head First Java on page 2

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

To run a class, the class needs to have a method declared like this:

public static void main(String[] args)

Does "Party" have such a method? If not, it's not intended to be run as a standalone application; perhaps it's part of a larger example, which you would run using some other class, or perhaps it's just meant as a partial example, not intended for you to run.


[Jess in Action][AskingGoodQuestions]
Socrates Farias de Barros
Greenhorn

Joined: Feb 27, 2009
Posts: 2
Thanks,

Must be a bigger example, I started the book I now look more check in the end.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
I believe that example in Head First is only part of an application and cannot be executed on its own.

But I may be mistaken.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help - Exception
 
Similar Threads
Connection to remote DB server to run JDBC application program
Exception in thread "main" java.sql.SQLException
java.lang.NoSuchMethodError
Main Method
OCPJP 6 Practice exams, exam 2 q 29 error