Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm a Java newbie who just a made a simple Java program using SWT for GUI via eclipse Juno. The code was working and the program was able to run inside eclipse, so I compiled it and made it a runnable jar file so it can be run outside eclipse. I tried to run it using the terminal and this error came up.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
no swt-gtk-4233 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/abody/.swt/lib/linux/x86_64/libswt-gtk-4233.so
Can't load library: /home/abody/.swt/lib/linux/x86_64/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:133)
at Class1.main(Class1.java:12)

So now it looks like it can't find libswt-gtk-4233.so and the other file. However, when I took a look at the .swt folder I had an libswt-gtk-3740.so not 4233.

So its trying to find a file that is more up-to-date. So what does that mean, should I update SWT? what's going on?

share|improve this question

1 Answer 1

You need to make a symbolic link to the swt so files located in the /usr/lib/jni directory. I found a solution on this site: Eclipse cannot load SWT libraries.

use this command:

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/
share|improve this answer
1  
Can you improve your answer by writing the needed command line ? Thank you. –  NorTicUs Nov 21 '12 at 13:47
    
sure, :-) done. –  wolfg Dec 29 '12 at 5:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.