File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help - Exception " Watch "Help - Exception " New topic

Help - Exception

Socrates Farias de Barros

Joined: Feb 27, 2009
Posts: 2

This is the error
Exception in thread "main" java.lang.NoSuchMethodError: main program in my book Head First Java on page 2

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


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

Joined: Feb 27, 2009
Posts: 2

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

Joined: Oct 13, 2005
Posts: 46362
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:
subject: Help - Exception
jQuery in Action, 3rd edition