javadbusnetworkmanager

How to link to "unix-java" from Java in 2019


I am using the NetworkManager / DBus code from here. It builds successfully but at runtime produces:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no unix-java in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
    at java.base/java.lang.System.loadLibrary(System.java:1870)
    at cx.ath.matthew.unix.UnixSocket.<clinit>(UnixSocket.java:40)
    at org.freedesktop.dbus.Transport.connect(Transport.java:772)
    at org.freedesktop.dbus.Transport.<init>(Transport.java:737)
    at org.freedesktop.dbus.DBusConnection.<init>(DBusConnection.java:299)
    at org.freedesktop.dbus.DBusConnection.getConnection(DBusConnection.java:282)

This is a Maven project. Can I fix this problem by pulling in another artifact or declaration? I've been going round in circles all day looking at stuff that's 10+ years old trying to work out if I'm using obsolete code because previously I'd been using my own classes generated via introspection but now apparently I need this extra library.

Or is the answer that this unix-java library is something I have to pull in via my distro's package manager? be it emerge, apt-get or whichever.


Solution

  • Thanks to all for their suggestions. What I eventually did was use this DBus stuff with this NetworkManager stuff. Obviously I had to change a lot of the import package names in kk-dbus-nm-java but the benefit is that hypfvieh's DBus stuff doesn't need a separate socket library.