• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception in thread main java.lang.noclassdeffounderror

 
William Pair
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot get past this. I can compile and get no errors, but when I try to run my little program I get the above error. I have updated my PATH in the System Variables of the Enviroment Variables just like in step 4 of the installation guide instructs.

import java.awt.*;
import java.awt.event.*;
class Party {
public void buildinvite() {
Frame F = new Frame();
Label l = new Label("Party at Tim's");
Button b = new Button("You bet");
Button c = new Button("Shoot me");
Panel p = new Panel();
p.add(l);
} // more code here...
}
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When posting code please UseCodeTags. Please explain how you ran it. I don't see a main() function. This is probably a classpath problem. Did you set your classpath?
 
Inder Kumar Rathore
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all welcome to java ranch.
William you are compiling your code that's Ok but how you are running it.
either provide whole source code or just explian.
And tom he is new to java ranch as it is his first post.
So errors can be there.
William just use proper tags to make your post more readable..
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Inder: Tom asked the right questions and provided a link regarding code tags--just telling someone to use the "proper tags" without providing a reference for how to do so doesn't really help.
 
Inder Kumar Rathore
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think tom has provided the link that's why i didn't...
 
William Pair
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone for all your help and advise. I will be a better greenhorn on my next posting. Yes I was able to correct my issue by adding a "main" method.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic