• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm reading the book "Head First Java" and have difficulties with some code:
import java.awt.*;
import java.awt.event.*;
class Party {

public void buildlnvite() {
Frame f = new Frame();
Label l = new Label("Party at Tim's");
Button b = new Button("You bet");
Button c = new Button("Schoot me");
Panel p = new Panel();
p.add(l);

}
}
Could someone explain the exception?
Thanks
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Sounds like you're trying to run your Party class without a main method. The main method is what the JVM uses to start off running a java program and every Java Program has a main method somewhere. The JVM requires it to have the following method signature:

So you might try the following:

Luck.
--BW

}
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not a Servlets question, but a Java in General (Beginner) question. I am going to move this thread to the more appropriate forum.
Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic