10

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.

Community
  • 1
  • 1
Nifty255
  • 397
  • 2
  • 3
  • 14
  • Can you include the manifest file here? – Baz Nov 29 '12 at 16:57
  • Edited question to include error and found out this error is with the GTK library, so I reworked the question. – Nifty255 Nov 29 '12 at 17:02
  • Maybe a duplicate of [Can't open Eclipse in Ubuntu 12.04 - java.lang.UnsatisfiedLinkError: Could not load SWT library](http://stackoverflow.com/questions/10970754/cant-open-eclipse-in-ubuntu-12-04-java-lang-unsatisfiedlinkerror-could-not-l) Also I found an entry in the [Ubuntu bugtracker](https://bugs.launchpad.net/ubuntu/+source/swt-gtk/+bug/975560). Maybe you can find useful workarounds or solutions there. – jens-na Nov 30 '12 at 13:29
  • I'm sure this would have helped if I didn't screw up poor Ubuntu to the point of re-installation. But, since I re-installed under VMWare, my SWT app now works properly. – Nifty255 Dec 03 '12 at 15:56
  • I solved by following this https://askubuntu.com/a/1194489/1155600 – Miftakhul Arzak Mar 15 '22 at 07:55

5 Answers5

10

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
ywu
  • 131
  • 2
  • 6
7

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.

Orjan
  • 87
  • 1
  • 3
  • 1
    This should not be closed. THe only detail that should be added to the question is that the environment is a 64 bit one, and eclipse needs ia32 libs – Luis Lobo Borobia Aug 07 '13 at 05:23
  • how to do the same in linux? this command is not working in linux 64 bit. – Helping Hand.. Feb 25 '14 at 13:27
  • 1
    found for 64 bit system, it helped me. ### sudo apt-get install libcanberra-gtk-module:i386 (run 32 bit lib for 64 bit system) ### sudo apt-get install libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 libglu1-mesa:i386 libxtst6:i386 – CoDe May 09 '14 at 05:13
  • 2
    Installing `libswt-gtk-3-java` fixed the issue in Debian sid. – eel ghEEz Aug 15 '18 at 19:08
  • 1
    `ia32-libs-gtk` has been removed from Debian on 2013-11-03. The last version which had it was `squeeze`. Today the problem can be fixed by installing `libswt-gtk-4-java` or `libswt-gtk-3-java`. – phobie Jun 11 '19 at 11:19
4

With latest Ubuntu (18.10), installing libswt-gtk-3-java fixed it. To do so, from a terminal, type the command: sudo apt install libswt-gtk-3-java

For most updated version, I would suggest following link: https://packages.ubuntu.com/search?keywords=swt-gtk

Mohamed El-Beltagy
  • 902
  • 10
  • 19
0

For more recent releases, if it says it can't find libgtk-3.so.0, the obvious package you need to apt-get install is libgtk-3-0. However, it seems on Ubuntu Zesty (17.04) there isn't such a package, so I needed to switch to Xenial (16.04). Artful and later should work too.

Also, the graphical Eclipse Installer won't work without this.

Yushin Washio
  • 675
  • 8
  • 12
0

This worked for me on i386/debian with docker:

apt-get install libgtk2.0-0 
JRichardsz
  • 14,356
  • 6
  • 59
  • 94