invokeLater() 上 Java Applet 中的 NoClassDefFoundError [英] NoClassDefFoundError in Java Applet on invokeLater()

查看:22
本文介绍了invokeLater() 上 Java Applet 中的 NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 NetBeans 构建的小程序,名为 AKApplet.它在 IDE 中运行良好,但是当我将其放入网页时,它会引发以下错误:

I have an applet I've built using NetBeans, called AKApplet. It runs fine in the IDE, but when I put it in a web page it throws the following error:

Exception in thread "Thread-15" java.lang.NoClassDefFoundError: AKApplet$2
    at AKApplet.run(AKApplet.java:675)

小程序使用 run() 方法在后台加载一些数据,同时保持 UI 响应.很标准的东西.在第 675 行,加载数据后,我尝试使用 invokeLater() 更新 UI 组件:

The applet uses the run() method to load some data in the background while keeping the UI responsive. Pretty standard stuff. At line 675, after the data has been loaded, I'm trying to update the UI components using invokeLater():

public void run() {

    // ... data loads ...

    // line 675:
    javax.swing.SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            userMessages.setText("Data loaded.");
            panelList.setVisible(true);
            validate();
            }
    });

}

我尝试更新的组件是 userMessages、JLabel 和 panelList 这是一个面板.然而,我认为它并没有那么远.

The components I'm trying to update are userMessages, a JLabel and panelList which is a Panel. I don't think it's getting that far however.

有人知道会发生什么吗?此时小程序已经加载完毕,可以看到组件并进行了更新等

Does anyone know what might be happening? At this point the applet has loaded and the components can be seen and have been updated, etc.

推荐答案

确保您不仅要部署 AKApplet.class,还要部署 AKApplet$1.classAKApplet$2.class

Make sure you're deploying not only AKApplet.class, but also AKApplet$1.class, AKApplet$2.class, etc.

这篇关于invokeLater() 上 Java Applet 中的 NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆