Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help - Exception

 
Socrates Farias de Barros
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Socrates Farias de Barros
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

Must be a bigger example, I started the book I now look more check in the end.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic