jwharm / java-gi

GObject-Introspection bindings generator for Java
GNU Lesser General Public License v2.1
84 stars 7 forks source link

Suppressed: java.lang.UnsatisfiedLinkError: no libgobject-2.0.so.0 in java.library.path: #94

Closed akashKarmakar02 closed 5 months ago

akashKarmakar02 commented 5 months ago

Exception in thread "main" java.lang.ExceptionInInitializerError at org.gnome.gobject.TypeInstance.(TypeInstance.java:43) at org.example.Main.(Main.java:15) at org.example.Main.main(Main.java:9) Caused by: io.github.jwharm.javagi.interop.InteropException: Could not load library libgobject-2.0.so.0 at io.github.jwharm.javagi.interop.LibLoad.loadLibrary(LibLoad.java:50) at org.gnome.gobject.GObjects.(GObjects.java:149) ... 3 more Suppressed: java.lang.UnsatisfiedLinkError: no libgobject-2.0.so.0 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458) at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916) at java.base/java.lang.System.loadLibrary(System.java:2063) at io.github.jwharm.javagi.interop.LibLoad.loadLibrary(LibLoad.java:54) ... 4 more

jwharm commented 5 months ago

Thanks for trying out java-gi!

The exception occured because the native libraries cannot be found in the default locations.

If you're on a Debian/Ubuntu-derived distribution, it's /lib/x86_64-linux-gnu. You can set it with the command line parameter -Djava.library.path=/lib/... or, if you use Gradle, check out this example.