Search code examples
javaraspberry-pi3

Java controller input on raspberry pi3b+


I'm trying to use jInput to get controller input. Works fine on Windows 10, but on Pi3B+ running Raspbian64, the program keeps looking for jinput-linux64.so. After installing the lib with apt and renaming libjinput.so to jinput-linux64.so, it keeps saying it is not found. How can I get the correct .so file?

Some other posts suggest symbolic links, but this does not seems to work either.

Here is the actual error:

java.lang.UnsatisfiedLinkError: no jinput-linux64 in java.library.path: /opt/java/libs/
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
        at java.base/java.lang.System.loadLibrary(System.java:1989)
        at net.java.games.input.LinuxEnvironmentPlugin.lambda$loadLibrary$0(LinuxEnvironmentPlugin.java:67)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at net.java.games.input.LinuxEnvironmentPlugin.loadLibrary(LinuxEnvironmentPlugin.java:61)
        at net.java.games.input.LinuxEnvironmentPlugin.<clinit>(LinuxEnvironmentPlugin.java:93)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:375)
        at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:133)
        at InputsWheel.init(InputsWheel.java:19)
        at InputsWheel.<init>(InputsWheel.java:13)
        at Main.main(Main.java:5)

Edit: It seems the error can be solved by naming the symlink libjinput-linux64.so. However, instead of button names, it spits out unknown.


Solution

  • Java says that it is looking for jinput-linux64.so, when you install it with apt, it gives you libjinput.so. However, the name of the file should be libjinput-linux64.so