java.lang.NoClassDefFoundError: MyClass$1
843807Sep 9 2008 — edited Sep 10 2008Hello everyone. I'm new in here and I dont know if this is the right forum to post my problem, I hope I didn't mess up.
I dealing with some code that I didn't write. It is an applet that uses a jar and a single class (PrinterApplet):
The war has a directory WEB-IF/classes/applets/ with these:
PrinterApplet.class, PrinterApplet$1.class, PrinterApplet$2.class, PrinterApplet$3.class, jasperreports-applet.jar among other things.
I had doubts about the jar in that folder so I copied to WEB-INF/lib also
The html with the applet:
<APPLET CODE = "PrinterApplet.class" CODEBASE = "." ARCHIVE = "PrinterApplet.class,jasperreports-2.0.1.jar" WIDTH = "300" HEIGHT = "40"></XMP>
<PARAM NAME = CODE VALUE = "PrinterApplet.class" >
<PARAM NAME = CODEBASE VALUE = "." >
<PARAM NAME = ARCHIVE VALUE = "PrinterApplet.class,jasperreports-2.0.1.jar" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.6.0">
<PARAM NAME="scriptable" VALUE="false">
<PARAM NAME = "REPORT_URL" VALUE ="/Jasfar/servlets/jasperprint">
</APPLET>
and this is what I get in the console:
java.lang.NoClassDefFoundError: PrinterApplet$1
at PrinterApplet.initComponents(PrinterApplet.java:99)
at PrinterApplet.<init>(PrinterApplet.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:786)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2108)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:715)
at sun.applet.AppletPanel.run(AppletPanel.java:369)
at java.lang.Thread.run(Thread.java:619)
basic: Exception: java.lang.NoClassDefFoundError: PrinterApplet$1
I am surprised that java finds PrinterApplet but PrinterApplet$1 no.
I beeng playing with the CODE and CODEBASE values but without success.
Any ideas of what could be wrong will be greatly appreciated. Thanks :)