1

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

Kimtho6
  • 6,154
  • 9
  • 40
  • 56
hirosima
  • 11
  • 2

2 Answers2

1

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

Andrew T Finnell
  • 13,417
  • 3
  • 33
  • 49
  • this SDK for mac but i improve the project on windows – hirosima Aug 05 '11 at 14:59
  • Just for a bit of clarification, Apple no longer wants to be forced to maintain Java for OS X (which they shouldn't have to). They've open-sourced all of their work and while they no longer include Java by default on new systems, trying to run a .JAR will cause a little popup asking if you'd like to install a JVM in one click. – TkTech Aug 05 '11 at 15:45
0

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

Community
  • 1
  • 1
bmargulies
  • 97,814
  • 39
  • 186
  • 310