2

I have an SWT application in which I have added SWT related dependency in pom.xml and then built it as maven project to download them and when I run it in eclipse IDE, then it runs and all the screens are launching.

But when I take the jar and try to run it via command line, it gives UnsatisfiedlinkError.

Detail stack trace is given below.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3346 or
swt-win32 in swt.library.path, java.library.path or the jar file
        at org.eclipse.swt.internal.Library.loadLibrary(Library.java:219)
        at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151)
        at org.eclipse.swt.internal.C.<clinit>(C.java:21)
        at org.eclipse.swt.widgets.Display.<clinit>(Display.java:126)

Any help regarding this will be hugely appreciated.

Subhankar
  • 487
  • 8
  • 25
  • This one: http://stackoverflow.com/questions/292548/how-do-you-build-an-swt-application-with-maven is asked long time ago but check the answers from urish and Mar which are more recent. Also check http://stackoverflow.com/questions/4140542/my-program-runs-fine-in-eclipse-but-throws-exception-running-as-a-jar-file --> "jar files which I needed to list in the Manifest.MF file - they were listed in the package explorer under JRE Reference Library. Adding them to the Manifest.mf File finally was the key" – zlinks Apr 08 '14 at 13:51

4 Answers4

2

I was able to solve the issue. Both the JRE which was running in command line and and in ide were same. But when Maven was getting built, that was pointing to 64 bit JRE. I made everything point to 32 bit then it worked. Similarly When I make everything to point to 64 bit, it works.!! Thanks everyone.

Subhankar
  • 487
  • 8
  • 25
1

Please check the version of JRE being used when running the app from Eclipse and Command Line

I guess the JRE used while running the jar from command line is 32-bit

Niranjan
  • 1,776
  • 1
  • 13
  • 21
0

Like the exception says:

no swt-win32-3346 or
swt-win32 in swt.library.path, java.library.path or the jar file

You have to have the swt libraries in one of these directories.

ifloop
  • 8,079
  • 2
  • 26
  • 35
  • Sorry but I didn't get you. In my jar, if I extract, I see that swt dll is present. Shouldn't that be enough ? – Subhankar Apr 08 '14 at 12:35
0

Even it matters which bit jar you have linked for SWT jar library support, recommended one is to have OS, JVM and Jar all three for 64 or 32 bit aligned all same OS bit version.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dhruv Rana
  • 21
  • 1
  • 2