java.lang.UnsatisfiedLinkError: Could not load SWT library

I have a Java application that I use regularly and never had any problems. Today I got this error for the first time when trying to start it:

!ENTRY org.eclipse.osgi 4 0 2022-08-15 11:02:29.479
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-pi4-gtk-4932r18 in java.library.path
    no swt-pi4-gtk in java.library.path
    Can't load library: /home/user/.swt/lib/linux/x86_64/libswt-pi4-gtk-4932r18.so
    Can't load library: /home/user/.swt/lib/linux/x86_64/libswt-pi4-gtk.so

I checked the location and I see that I have:

/home/user/.swt/lib/linux/x86_64/libswt-pi3-gtk-4932r18.so

but not the pi4 version.

However, I have this version of eclipse-swt:

# zypper if eclipse-swt
Loading repository data...
Reading installed packages...


Information for package eclipse-swt:
------------------------------------
Repository     : Main Repository (OSS)
Name           : eclipse-swt
Version        : 4.15-8.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 7.3 MiB
Installed      : Yes
Status         : up-to-date
Source package : eclipse-4.15-8.1.src
Upstream URL   : https://www.eclipse.org/
Summary        : SWT Library for GTK+
Description    : 

    SWT Library for GTK+.

Which is apparently the correct one. But searching for it does not seem to show v 4:

# find /usr -name swt
/usr/lib64/eclipse/plugins/org.eclipse.swt.gtk.linux.x86_64_3.114.0.v20200407-0844/org/eclipse/swt

What is going on here? How can I overcome this error?

This cannot possibly be a problem with the application, because it was working fine two weeks ago and I have not changed it. It must be related to upgrades in Tumbleweed.

Thanks for any hint!

1 Like

I have spent now more than two hours exploring this issue. It seems the requested libraries are not provided by any package currently available on openSUSE repositories.

The package eclipse-swt is supposed to provide libswt-pi*****-gtk* but it does not offer the currently required libswt-pi4-gtk*

# zypper if --provides eclipse-swt
Loading repository data...
Reading installed packages...


Information for package eclipse-swt:
------------------------------------
Repository     : Main Repository (OSS)
Name           : eclipse-swt
Version        : 4.15-8.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 7.3 MiB
Installed      : No
Status         : not installed
Source package : eclipse-4.15-8.1.src
Upstream URL   : https://www.eclipse.org/
Summary        : SWT Library for GTK+
Description    : 

    SWT Library for GTK+.
Provides       : [14]
    libswt-atk-gtk-4932r18.so()(64bit)
    libswt-awt-gtk-4932r18.so()(64bit)
    libswt-cairo-gtk-4932r18.so()(64bit)
    libswt-glx-gtk-4932r18.so()(64bit)
    libswt-gtk-4932r18.so()(64bit)
    libswt-pi3-gtk-4932r18.so()(64bit)
    libswt-webkit-gtk-4932r18.so()(64bit)
    libswt-webkit2extension-gtk-4932r18.so()(64bit)
    eclipse-swt = 4.15-8.1
    osgi(org.eclipse.swt) = 3.114.0
    eclipse-swt(x86-64) = 4.15-8.1
    mvn(org.eclipse.swt:org.eclipse.swt) = 3.114.0.v20200407.0844
    mvn(org.eclipse.swt:swt) = 3.114.0.v20200407.0844
    osgi(org.eclipse.swt.gtk.linux.x86_64) = 3.114.0


Still digging … :slight_smile:

Adding to the above, in case this is of use to anyone apart from myself. It seems that there is indeed a newer version of eclipse-swt (4.9.0) that could possibly provide the missing requirement but is currently only available for Tumbleweed i586 and not for x86_64:

https://build.opensuse.org/package/binaries/Java:packages/eclipse-swt/openSUSE_Tumbleweed

Perhaps it is only a matter of a few days or weeks before the package is available.

Update: I have now bypassed this problem by disabling the particular JRE shipped with the software in question and allowing it to run the one in the system. The problem then was likely was caused by conflicts between JRE’s and not by a problem with openSUSE’s Java.

1 Like