NoClassDefFoundException

NoClassDefFoundException

following code has compiled sucessfully but at run time it givs error "NoClassDefFoundException". no other erorr


import java.awt.*;
import java. awt.event.*;

public class marks extends Frame implements ActionListener
{
Label l= new Label("enter the roll");
Label l1= new Label("enter the name");
Label l2= new Label("enter the marks");
TextField t= new TextField(10);
TextField t1= new TextField(10);
TextField t2= new TextField(10);
TextField t3= new TextField(10);
Button b= new Button("Result");
Button b1= new Button("Exit");

marks(String s)
{
super (s);
setLayout(new GridLayout(5,2));
add(l);
add(t);
add(l1);
add(t1);
add(l2);
add(t2);
add(t3);
add(b);
add(b1);
b.addActionListener(this);
b1.addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b)
{
int n = Integer.parseInt(t2.getText());
if(n>=60)
{
t3.setText("Pass");
}
else
{
t3.setText("Fail");
}
}
if(e.getSource()==b1)
{
System.exit(0);
}
}
public static void main(String args[])
{
marks m = new marks("my Frame");
m.setSize(300,300);
m.setVisible(true);
}
}
View Answers

January 22, 2010 at 2:49 PM

Hi Friend,

It seems that you haven't saved your class with marks.java.Therefore you have got this error.

Thanks









Related Tutorials/Questions & Answers:
NoClassDefFoundException - Java Beginners
NoClassDefFoundException  following code has compiled sucessfully but at run time it givs error "NoClassDefFoundException". no other erorr import java.awt.*; import java. awt.event.*; public class marks extends Frame

Ads