开发者

Java: compile on Windows, run on OS X = fail, why? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

I don't know much 开发者_开发知识库about compiling files: when I tried compiling files on Windows Vista, the JAR file works fine, the application runs just fine. I copied all files to a Mac OS X, tried to run the JAR file, nothing happen, the application doesn't work, why?

EDIT: When I try to display a JFrame, I get the error only in Mac OS X:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/swing/GroupLayout$Group

GroupLayout is created by Netbeans by drag-and-drop components to the JFrame. Please help!


A common problem (if you have a Swing GUI), is that not all of Swing is available on OSX. I encountered this problem after creating a game in Java at university and tried to show it off to my Dad on his Mac...

Have you tried running the JAR from the command line to see what, if any exceptions are being thrown?


If your program contains absolutely path, like

D:\Foo\bar...

it will not work.

or if it has some platform dependences code.

Try to remove this code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜