| | |
java.lang.NoClassDefFoundError: JBuilder
![]() |
•
•
Join Date: Sep 2006
Posts: 68
Reputation:
Solved Threads: 0
•
•
•
•
Ah, don't worry about that. i thought you were referencing a class, but you are using an IDE called JBuilder. My mistake.
Could you post your code up here? Remember to wrap it in [C0DE][/C0DE] tags.
import javax.swing.*;
import java.awt.*;
public class CreateGUI{
public void createAndShowGUI(){
JFrame myFram = new JFrame();
myFram.setDefaultCloseOperation(myFram.EXIT_ON_CLOSE);
Container contentPane = myFram.getContentPane();
JLabel myLable = new JLabel("hellow world");
contentPane.add(myLable);
myFram.pack();
myFram.setVisible(true);
}
}
public class TestGUI {
public static void main (String[] args){
CreateGUI myGui = new CreateGUI();
myGui.createAndShowGUI();
}
}
this is my simple programe.
[IMG]file:///C:/DOCUME%7E1/JANAKA%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/JANAKA%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/JANAKA%7E1/LOCALS%7E1/Temp/moz-screenshot-2.jpg[/IMG]the below is the error massage that i got
java.lang.NoSuchMethodError: main
Exception in thread "main"
but the most terrible problem is, when i copy these two classes into a new project that was created by same JBuilder IDE, it is running properly.
i want to find why is that
please help me
thanks
The compiler is having problems finding your main method. With a program this simple, one class is more than sufficient, so I'd suggest taking your main method out of TestGUI and trying to compile with it inside CreateGUI (btw, this should be called something more distinctive, like HelloWorld; a classname should tell you something about what the class is for).
Please anyone, correct me if I am wrong. It is the best way for me to learn.
![]() |
Similar Threads
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- exception in thread "main" java.lang.NoClassDefFoundError (Java)
- Following tutorials and getting java.lang.NoClassDefFoundError (Java)
Other Threads in the Java Forum
- Previous Thread: java image animation not working????
- Next Thread: cannot install jdk 5 beta version
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card character class client code collision component crashcourse css csv database eclipse ee error fractal free game gis givemetehcodez graphics gui html ide image integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan machine map method methods migrate mobile netbeans newbie objects oriented output panel phone physics problem program programming project projects radio recursion replaydirector reporting researchinmotion scanner se server service set sms software sort sql string swing test textfield threads transfer tree trolltech ubuntu utility windows






