tags:

views:

21

answers:

1

I'm not sure why I get a java.lang.NoClassDefFoundError runtime error on the following line:

  this.startBtn.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
      startClicked();
    }
  });

in an Applet. It compiles fine. How can the jre not find a core awt class? I use the same line in a different applet without issues. What am I not understanding?

Thanks in advance

A: 

Take a look at "NoClassDefFoundError in Java Applet on invokeLater()". Compiling the class that contains your code snippet will produce other class files like MyClass$1.class. Make sure they're also deployed.

kschneid
if the class isn't in the classpath, `ClassNotFoundException` should be the one thrown.
irreputable
Thanks! You nailed it.
LeftHem
@irreputable: Not in this case. If an application were using something like `Class.forName()`, then `ClassNotFoundException` might be thrown.
kschneid