Guest brunoss Posted June 29, 2004 Report Share Posted June 29, 2004 Não consigo entender o porquê que está dando esse erro!!!Por favor me ajudem!java.lang.NoClassDefFoundError: P4/Aula_27-05-04/N1 (wrong name: N1) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)Exception in thread "main" segue o código:public class N1 extends java.applet.Applet { /** Initializes the applet N1 */ public void init() { initComponents(); } /** This method is called from within the init() method to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() { textField1 = new java.awt.TextField(); panel1 = new java.awt.Panel(); button1 = new java.awt.Button(); button2 = new java.awt.Button(); button3 = new java.awt.Button(); button4 = new java.awt.Button(); button5 = new java.awt.Button(); button6 = new java.awt.Button(); button7 = new java.awt.Button(); button8 = new java.awt.Button(); button9 = new java.awt.Button(); button10 = new java.awt.Button(); button11 = new java.awt.Button(); button12 = new java.awt.Button(); button13 = new java.awt.Button(); button14 = new java.awt.Button(); button15 = new java.awt.Button(); setLayout(new java.awt.BorderLayout()); textField1.setText("textField1"); textField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField1ActionPerformed(evt); } }); add(textField1, java.awt.BorderLayout.NORTH); panel1.setLayout(new java.awt.GridLayout(5, 3)); button1.setLabel("1"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); panel1.add(button1); button2.setLabel("2"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button2ActionPerformed(evt); } }); panel1.add(button2); button3.setLabel("3"); panel1.add(button3); button4.setLabel("4"); panel1.add(button4); button5.setLabel("5"); panel1.add(button5); button6.setLabel("6"); panel1.add(button6); button7.setLabel("7"); panel1.add(button7); button8.setLabel("8"); panel1.add(button8); button9.setLabel("9"); panel1.add(button9); button10.setLabel("0"); panel1.add(button10); button11.setLabel("+"); panel1.add(button11); button12.setLabel("-"); panel1.add(button12); button13.setLabel("/"); panel1.add(button13); button14.setLabel("*"); panel1.add(button14); button15.setLabel("="); panel1.add(button15); add(panel1, java.awt.BorderLayout.CENTER); } private void button2ActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: if (textField1.getText()=="") textField1.setText("2"); else textField1.setText(textField1.getText() + 2); } private void button1ActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: if (textField1.getText()=="") textField1.setText("1"); else textField1.setText(textField1.getText() + 1); } private void textField1ActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: } // Variables declaration - do not modify private java.awt.Button button1; private java.awt.Button button10; private java.awt.Button button11; private java.awt.Button button12; private java.awt.Button button13; private java.awt.Button button14; private java.awt.Button button15; private java.awt.Button button2; private java.awt.Button button3; private java.awt.Button button4; private java.awt.Button button5; private java.awt.Button button6; private java.awt.Button button7; private java.awt.Button button8; private java.awt.Button button9; private java.awt.Panel panel1; private java.awt.TextField textField1; // End of variables declaration } Quote Link to comment Share on other sites More sharing options...
0 Kabelera Posted June 29, 2004 Report Share Posted June 29, 2004 hehe apostoque foi o Jbuider, ou NetBeans qe gerou esse código ae.....você fez os imports no começõ do programa??? você digitou o nome certo do arquivo.java?? você criou a variável de ambiente para copilar?? Quote Link to comment Share on other sites More sharing options...
Question
Guest brunoss
Não consigo entender o porquê que está dando esse erro!!!
Por favor me ajudem!
java.lang.NoClassDefFoundError: P4/Aula_27-05-04/N1 (wrong name: N1)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Exception in thread "main"
segue o código:
public class N1 extends java.applet.Applet {
/** Initializes the applet N1 */
public void init() {
initComponents();
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
textField1 = new java.awt.TextField();
panel1 = new java.awt.Panel();
button1 = new java.awt.Button();
button2 = new java.awt.Button();
button3 = new java.awt.Button();
button4 = new java.awt.Button();
button5 = new java.awt.Button();
button6 = new java.awt.Button();
button7 = new java.awt.Button();
button8 = new java.awt.Button();
button9 = new java.awt.Button();
button10 = new java.awt.Button();
button11 = new java.awt.Button();
button12 = new java.awt.Button();
button13 = new java.awt.Button();
button14 = new java.awt.Button();
button15 = new java.awt.Button();
setLayout(new java.awt.BorderLayout());
textField1.setText("textField1");
textField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textField1ActionPerformed(evt);
}
});
add(textField1, java.awt.BorderLayout.NORTH);
panel1.setLayout(new java.awt.GridLayout(5, 3));
button1.setLabel("1");
button1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button1ActionPerformed(evt);
}
});
panel1.add(button1);
button2.setLabel("2");
button2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button2ActionPerformed(evt);
}
});
panel1.add(button2);
button3.setLabel("3");
panel1.add(button3);
button4.setLabel("4");
panel1.add(button4);
button5.setLabel("5");
panel1.add(button5);
button6.setLabel("6");
panel1.add(button6);
button7.setLabel("7");
panel1.add(button7);
button8.setLabel("8");
panel1.add(button8);
button9.setLabel("9");
panel1.add(button9);
button10.setLabel("0");
panel1.add(button10);
button11.setLabel("+");
panel1.add(button11);
button12.setLabel("-");
panel1.add(button12);
button13.setLabel("/");
panel1.add(button13);
button14.setLabel("*");
panel1.add(button14);
button15.setLabel("=");
panel1.add(button15);
add(panel1, java.awt.BorderLayout.CENTER);
}
private void button2ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
if (textField1.getText()=="")
textField1.setText("2");
else
textField1.setText(textField1.getText() + 2);
}
private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
if (textField1.getText()=="")
textField1.setText("1");
else
textField1.setText(textField1.getText() + 1);
}
private void textField1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
}
// Variables declaration - do not modify
private java.awt.Button button1;
private java.awt.Button button10;
private java.awt.Button button11;
private java.awt.Button button12;
private java.awt.Button button13;
private java.awt.Button button14;
private java.awt.Button button15;
private java.awt.Button button2;
private java.awt.Button button3;
private java.awt.Button button4;
private java.awt.Button button5;
private java.awt.Button button6;
private java.awt.Button button7;
private java.awt.Button button8;
private java.awt.Button button9;
private java.awt.Panel panel1;
private java.awt.TextField textField1;
// End of variables declaration
}
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.