Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu: SWT App Can't Load GTK Library

I have supplied the Linux SWT jar and packaged my app in Eclipse to include swt.jar inside my app's jar. When I try to run it on Ubuntu, I get the following error text (posting only cause):

Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:

no swt-pi-gtk-4234 in java.library.path

no swt-pi-gtk in java.library.path

/home/nifty/.swt/lib/linux/x86/libswt-pi-gtk-4234.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

Can't load library: /home/nifty/.swt/lib/linux/x86/libswt-pi-gtk.so

This indicates to me it can't load a GTK file, but anything beyond that, and I'm at a loss. I'm only using Ubuntu to test my app, so I know very little.

like image 970
Nifty255 Avatar asked Nov 29 '12 16:11

Nifty255


2 Answers

Here is how I fix that missing lib on my Ubuntu 13.10 x86_64:

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: /home/ywu/.eclipse/473605238/configuration/org.eclipse.osgi/bundles/361/1/.cp/libswt-pi-gtk-4236.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

ywu@ywu-HP-8100:~$ aptitude search libgtk2.0-0
    i   libgtk2.0-0                   - GTK+ graphical user interface library                                                         
    p   libgtk2.0-0:i386              - GTK+ graphical user interface library
ywu@ywu-HP-8100:~$ sudo apt-get install libgtk2.0-0:i386
like image 174
ywu Avatar answered Oct 18 '22 00:10

ywu


On my 64-bit Debian Wheezy/testing I solved it by doing

apt-get install ia32-libs-gtk

(http://www.eclipse.org/forums/index.php/t/262868/). If your system isn't a 64-bit system then this suggestion is not applicable.

like image 45
Orjan Avatar answered Oct 18 '22 00:10

Orjan