This discussion is archived
1 Reply Latest reply: Nov 22, 2010 5:06 PM by 817194 RSS

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

817165 Newbie
Currently Being Moderated
Hi everyone I am beginner with Java and probably not first who encountered problems with compiled source code. I give an example of my code it comes from a book "Head First Java" page 28 this code looks like this :

import java.awt.*;
import java.awt.event.*;
class Party {
public void makeInvitation(){
Frame f = new Frame();
Label l = new Label("Party at Toms");
Button b = new Button("Sure!");
Button c = new Button("Eee...");
Panel p = new Panel();
p.add(l);
}
}

after I compiled it as Type of file : CLASS file


In Command Prompt I write : java Party and this error like : Exception in thread "main" java.lang.NoSuchMethodError :main

I struggle with this for 3weeks :( Can anyone can help....

Thank you in advance Artur

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points