This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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 REST with Spring (video course) this week in the Spring forum!
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: 24195


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: 45286
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.
Don't get me started about those stupid light bulbs.
subject: Help - Exception
It's not a secret anymore!