Weird ClassNotFound error with applet
Error:
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.Stuffez.UploadApplet.UploadApplet
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3013)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1444)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.Stuffez.UploadApplet.UploadApplet
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
开发者_如何学Go 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.plugin2.applet.Plugin2Manager$12.run(Plugin2Manager.java:2955)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.Stuffez.UploadApplet.UploadApplet
I have NO idea what is causing that, com.Stuffez.UploadApplet.UploadApplet exists, and it works in Eclipse...
Embed code:
<APPLET archive="UploadApplet.jar" code="com.Stuffez.UploadApplet.UploadApplet" width="200" height="200">
</APPLET>
What is happening?
The cause of this is that some unchecked exception was thrown during the static initialization of the applet class, or some class that the applet class depends on.
The actual root cause exception is not shown in the segment of the stacktrace in your question. It might be in the full stacktrace, or it might be in an earlier stacktrace.
When an exception is thrown during class initialization, the JVM will not attempt to initialize the class again. It just reports that it "Could not initialize class ..." without telling you why. This can be rather confusing if you've never seen it before.
精彩评论