Hi All,I am run applet which has imports swing . I am getting the following error in java debug console . i have search this forum look like a classpath issue but i do not know how to resolve it .
java.lang.NoClassDefFoundError
File not found when looking for: HelloWorldSwing$1
java.lang.NoClassDefFoundError: HelloWorldSwing$1
at HelloWorldSwing.init(HelloWorldSwing.java:28)
at COM.ibm.JEmpower.applet.AppletFrame.run(AppletFrame.java:460)
at java.lang.Thread.run(Thread.java:570)
File not found when looking for: HelloWorldSwing$1
java.lang.NoClassDefFoundError: HelloWorldSwing$1
at HelloWorldSwing.init(HelloWorldSwing.java:28)
at COM.ibm.JEmpower.applet.AppletFrame.run(AppletFrame.java:460)
at java.lang.Thread.run(Thread.java:570)
File not found when looking for: HelloWorldSwing$1
java.lang.NoClassDefFoundError: HelloWorldSwing$1
at HelloWorldSwing.init(HelloWorldSwing.java:28)
at COM.ibm.JEmpower.applet.AppletFrame.run(AppletFrame.java:460)
at java.lang.Thread.run(Thread.java:570)
Subject: java.lang.NoClassDefFoundError - while run applet :
Hi ,Thanks alot for your response . Here is the source code.
import javax.swing.*;
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
public class HelloWorldSwing extends JApplet {
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
//Add the ubiquitous "Hello World" label.
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public void init() {
//Execute a job on the event-dispatching thread:
//creating this applet's GUI.
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
} catch (Exception e) {
System.err.println("createGUI didn't successfully complete");
}