NoClassDefFoundError:Mac 计算机上的 javax/swing/GroupLayout$Group

发布于 2024-08-12 18:40:57 字数 2140 浏览 8 评论 0原文

仅当我在 Mac 计算机上测试 Java 程序时,才会出现运行时错误。它在各种 Windows 操作系统上测试完美。这是我在 Mac 计算机上收到的错误消息...

线程“AWT-EventQueue-0”中的异常 java.lang.NoClassDefFoundError: javax/swing/GroupLayout$Group 在项目.MainPanel.calculateButtonActionPerformed(MainPanel.java:198) 在project.MainPanel.access$200(MainPanel.java:32) 在项目.MainPanel$3.actionPerformed(MainPanel.java:97) 在javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882) 在 javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202) 在 javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420) 在 javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) 在javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) 在 java.awt.Component.processMouseEvent(Component.java:5602) 在 javax.swing.JComponent.processMouseEvent(JComponent.java:3135) 在 java.awt.Component.processEvent(Component.java:5367) 在 java.awt.Container.processEvent(Container.java:2010) 在 java.awt.Component.dispatchEventImpl(Component.java:4068) 在 java.awt.Container.dispatchEventImpl(Container.java:2068) 在 java.awt.Component.dispatchEvent(Component.java:3903) 在java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256) 在java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936) 在java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866) 在 java.awt.Container.dispatchEventImpl(Container.java:2054) 在 java.awt.Window.dispatchEventImpl(Window.java:1801) 在 java.awt.Component.dispatchEvent(Component.java:3903) 在 java.awt.EventQueue.dispatchEvent(EventQueue.java:463) 在java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatch!Thread.j ava:269) 在java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) 在java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) 在java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) 在 java.awt.EventDispatchThread.run(EventDispatchThread.java:110)\

我不知道为什么会发生这种情况。我在 Windows 计算机上编译该程序是否是问题所在?这是我唯一能想到的。

I am having a runtime error ONLY when I test my Java program on a mac computer. It tests perfectly fine on various Windows operating systems. This is the error message I get on a Mac computer...

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/swing/GroupLayout$Group
at project.MainPanel.calculateButtonActionPerformed(MainPanel.java:198)
at project.MainPanel.access$200(MainPanel.java:32)
at project.MainPanel$3.actionPerformed(MainPanel.java:97)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatch! Thread.j ava:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)\

I do not know why this is happening. Could the fact that I compiled the program on a Windows computer be the problem? That is the only thing that I could think of.

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

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

发布评论

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

评论(3

感性 2024-08-19 18:40:57

在 OS X 下,Java 的默认版本是 Java 1.5。

确保正确的 jvm 的唯一好方法是使用 java Web start。

Under OS X the default version of Java is Java 1.5.

The only good Way to ensure the right jvm is with java Web start.

染年凉城似染瑾 2024-08-19 18:40:57

如果无法对此进行测试,我会假设这是因为您编译此文件的 Java 版本高于您在 Macintosh 上运行的 Java 版本。

我建议您检查每个版本,并确保您在 Mac OS 下运行的版本是相同的或更高版本。

或者,您可以尝试使用 javac 的“-target”选项来设置旧版本,看看是否有帮助。

Without being able to test this, I would assume that this is because the Java version that you compiled this under is greater than the Java version that you are running on your Macintosh.

I suggest that you check the versions of each and make sure that the version which you are running under Mac OS is the same, or later.

Alternatively, you could try using the "-target" option for javac to set an older version and see if that helps.

轻许诺言 2024-08-19 18:40:57

您必须将 java 版本升级到最低 1.6。首先,如果您没有 1.6,请在终端上输入“java -version”来检查您的 java 版本,转到 Spotlight,编写 java 并在 Java Preferences 中将 Java SE 6 拖放到列表顶部,一切都完成了。退出就这样了。

You have to upgrade your java version to 1.6 minimum. First of all you check your java version on terminal by typing "java -version" if you don't have the 1.6, go to the Spotlight, write java and in Java Preferences drag and drop Java SE 6 to the top of the list, and it was done. Exit and that's it.

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