hirosima
hirosima

Reputation: 11

how to run jar file on mac

I have developed a app with external library(DJProject) in eclipse on windows OS and myjar file run success on windows but when i bring myjar into macintosh i have exception;

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$InProcess.initialize(SWTNativeInterface.java:559)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$InProcess.access$2(SWTNativeInterface.java:558)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.initialize_(SWTNativeInterface.java:238)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface.initialize(NativeInterface.java:71)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.open_(SWTNativeInterface.java:316)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:100)
    at SwtClassDeneme.runBrowser(SwtClassDeneme.java:58)
    at SwtClassDeneme.main(SwtClassDeneme.java:49)

how can i solve this stuation?

thanks

Upvotes: 1

Views: 1443

Answers (2)

Andrew T Finnell
Andrew T Finnell

Reputation: 13628

64-bit Eclipse for OSX

Grab the 64-bit SWT binaries from that installation. You are in luck that they finally decided to create a 64-bit SWT binary for OSX, they had previously claimed they never would.

plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.6.1.v3655c.jar (The version on the end will be different) should contain what you want.

Temporal Comments 08/05/2011

Also from a pragmatic point of view realize that Apple has End of Lifed their JVM on OS X. They want nothing to do with Java but that is a different debate. From my understanding the good folks that work on OpenJVM have it working on OS X.

Temporal Comment End

Upvotes: 1

bmargulies
bmargulies

Reputation: 100003

SWT has native code. So you have to build your package to target the precise target you are aiming for. I'm sort of amazed that you only got a 32 versus 64-bit error, I'd expect almost that it would try to load the Windows DLLs!

You need to configure SWT to target the 64-bit MacOS JVM. If you're using RCP, you need different OSGi fragments. If you are using native SWT, you need to work at that level.

Some of what you need to know exists in a prior question/answer, see:

Create cross platform Java SWT Application

Upvotes: 0

Related Questions