Home Answers Viewqa Java-Beginners NoClassDefFoundException

 
 


ashu
NoClassDefFoundException
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners

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 Pages:
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.