尝试运行使用绝对布局的JAR时出现NoClassDefFoundError [英] NoClassDefFoundError when trying to run JAR which uses Absolute Layout
问题描述
我已经使用NetBeans表单编辑器为我的程序开发了一个swing GUI.我使用AbsoluteLayout,以便可以将组件单击并拖动到需要它们放在框架上的任何位置.问题是,当我尝试运行为程序制作的可执行JAR文件时,出现以下错误:
I have developed a swing GUI for my program using the NetBeans form editor. I used the AbsoluteLayout so that I could click and drag components to wherever I needed them to go on the frame. The problem is that when I try to run the executable JAR file that I made for the program, I get the following error:
java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout ...线程"main"中的异常
java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout ...Exception in thread "main"
所有的GUI代码都是由NetBeans为我编写的,所以我不确定这里是什么问题.
All of the GUI code was written for me by NetBeans so I'm not sure what the problem is here.
我真的很喜欢使用表单编辑器,因为当我尝试对其进行硬编码时,使GUI看起来像我希望它们看起来非常繁琐.该程序需要用于JavaWebStart,因此必须位于可运行的可执行JAR文件中.
I really like using the form editor because getting GUI's to look like I want them to is extremely tedious when I try to hard-code it myself. The program needs to be used for JavaWebStart and so it has to be in a working executable JAR file.
推荐答案
尝试将AbsoluteLayout jar文件添加为库,然后从该库中导入AbsoluteLayout
.您可以从此处获取该jar.
Try add the AbsoluteLayout jar file as a library and import the AbsoluteLayout
from that library. You can get the jar from here.
这篇关于尝试运行使用绝对布局的JAR时出现NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!