Hi All,

I hv written a java swing class in Eclipse IDE.
i hope the code is 100% correct but when im running the class, the error message is displaying in the console. As

Exception in thread "main" java.lang.NoClassDefFoundError: com/cname/lct/madm/gui/madmplugin/rani/ConfirmExitDialog

Below is my code

package com.cname.lct.madm.gui.madmplugin.rani;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class ConfirmExitDialog extends JFrame {

public ConfirmExitDialog() {

     
     super("Confirm Exit Dialog Example");
     this.setSize(350, 150);
     
     Container contentPane = this.getContentPane();
     contentPane.setLayout(new BorderLayout());

     JLabel label1 = new JLabel("Confirm Exit Dialog Example", JLabel.LEFT);

     contentPane.add(label1, BorderLayout.SOUTH);
     
 }

 protected void processWindowEvent(WindowEvent e) {

     if (e.getID() == WindowEvent.WINDOW_CLOSING) {
         int exit = JOptionPane.showConfirmDialog(this, "Are you sure to exit?");
         if (exit == JOptionPane.YES_NO_OPTION)
         {
             System.exit(0);
         }
     } else {
         super.processWindowEvent(e);
     }
 }


 
public static void main(String[] args) {
     ConfirmExitDialog mainFrame = new ConfirmExitDialog();
     mainFrame.setVisible(true);

     //mainFrame.show();
 }
}

I dont know how to resolve this error
Please help me to solve the error.:(

Regards,
Ranithomas.

If you are able to compile the program, you must have the library with the classes needed.
You need to make that library available at execution time so the java.exe program can find the missing class.

If you are able to compile the program, you must have the library with the classes needed.
You need to make that library available at execution time so the java.exe program can find the missing class.

Thanks NormR1.
That error is solved by creating a new project and i hv recompiled that. no errors now. running properly.
But anyways, thanks for ur precious reply, i will check with that old file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.