简体   繁体   中英

Error while launching my java application(swt) on Mac

I am developing a java application on windows 7 (32 bit) machine. I used SWT in my application and run it by Java Web Start. It is working fine on windows 7 but when I try to run it on MAC OSX 10.6.8 it is unable to launch my application. I have added "swt-3.7M5-win32-win32-x86.jar" in my library. I added the following line in my jnlp file to run it on 32 bit JVM:

<j2se version="1.6+" java-vm-args="-d32" href="http://java.sun.com/products/autodl/j2se"/>

but still it is not working.

It is throwing the following error:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1914)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1847)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1609)
at com.sun.javaws.Launcher.run(Launcher.java:138)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-win32-3721 in java.library.path
no swt-win32 in java.library.path
Can't load library: /Users/Rajivj/.swt/lib/macosx/x86/libswt-win32-3721.jnilib
Can't load library: /Users/Rajivj/.swt/lib/macosx/x86/libswt-win32.jnilib

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 rtlmatrixcloud.Main.main(Main.java:32)
... 9 more

Can anyone tell me How do I solve this problem?

Any help would be appreciated.

Thanks Sonal

This is the root problem:

Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-win32-3721 in java.library.path
no swt-win32 in java.library.path
Can't load library: /Users/Rajivj/.swt/lib/macosx/x86/libswt-win32-3721.jnilib
Can't load library: /Users/Rajivj/.swt/lib/macosx/x86/libswt-win32.jnilib

First check that these lib files are there. I believe they are because it says "UnsatisfiedLinkError" and does not complain that file is not found. In this case check your SWT installation. It seems these libraries do not match your JVM. Typically such exception is thrown when for example 32 bit JVM tries to invoke 64 bit library or vice versa.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM