Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

817165Nov 21 2010 — edited Nov 22 2010
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2010
Added on Nov 21 2010
1 comment
170 views