SWT application is running from Eclipse IDE, not running when I create a jar via Maven and run. Gives UnsatisfiedlinkException

StackOverflow https://stackoverflow.com/questions/22935500

Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top