小程序出现奇怪的 ClassNotFound 错误

发布于 2024-09-25 08:04:33 字数 2046 浏览 0 评论 0原文

错误:

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)
    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

我不知道是什么原因造成的,com.Stuffez.UploadApplet.UploadApplet 存在,并且它在 Eclipse 中工作...

嵌入代码:

<APPLET archive="UploadApplet.jar" code="com.Stuffez.UploadApplet.UploadApplet" width="200" height="200">
</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)
    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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆沫 2024-10-02 08:04:33

造成这种情况的原因是小程序类静态初始化时抛出了一些未检查的异常,或者是小程序类所依赖的某个类。

实际的根本原因异常未显示在您问题中的堆栈跟踪部分中。它可能位于完整的堆栈跟踪中,也可能位于较早的堆栈跟踪中。

当类初始化期间抛出异常时,JVM 将不会尝试再次初始化该类。它只是报告“无法初始化类...”,但没有告诉您原因。如果您以前从未见过它,这可能会相当令人困惑。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文