Using Joystick / Gamepad with Linux?

I’m attempting to use a joystick (XBox 360 USB) in my jMonkey test program running under Linux (Ubuntu) inside of Alpha-4 IDE. The system recognizes the joystick as /dev/input/js0, and Linux-based jstest works fine. I never get to my breakpoints in the initJoysticks() method since I hit this:



Loading: net.java.games.input.LinuxEnvironmentPlugin

Failed to load library: no jinput-linux in java.library.path

net.java.games.input.LinuxEnvironmentPlugin is not supported

java.lang.UnsatisfiedLinkError: no jinput-linux in java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)

at java.lang.Runtime.loadLibrary0(Runtime.java:823)



I have tried explicitly set the library path with -Djava.library.path to point to the directory where I have libjinput-linux.so as directed by some other suggestions I’ve found looking around. The file is world readable and executable.



I’m just not clear if the statement in the error above “LinuxEnvironmentPlugin is not supported” means ‘you are screwed on Linux’ or what.



Any suggestions, and/or working test code much appreciated.

Try setting useJoysticks on the AppSettings to true

If you specified it properly the native library should automatically get extracted so you wouldn’t even get that error

thanks for your reply. I just added that but still this error:



Loading: net.java.games.input.LinuxEnvironmentPlugin

Failed to load library: no jinput-linux in java.library.path

net.java.games.input.LinuxEnvironmentPlugin is not supported

java.lang.UnsatisfiedLinkError: no jinput-linux in java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)

at java.lang.Runtime.loadLibrary0(Runtime.java:823)

at java.lang.System.loadLibrary(System.java:1028)



On a somewhat related note, I tried the same code on a Mac at home- with the settings.setUseJoysticks(true); - and got basically the same result of the OsxEnvironmentPlugin. So I think I’m messing something up in my install.



If I run the provided jme3test.input.TestJoystick I get:



Loading: net.java.games.input.LinuxEnvironmentPlugin

java.lang.UnsatisfiedLinkError: no jinput-linux in java.library.path

Failed to load library: no jinput-linux in java.library.path

net.java.games.input.LinuxEnvironmentPlugin is not supported

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1

We’re experiencing the same problems here. Did you come to a solution?

[Update: Somehow, we couldn’t get the native libraries to be used – the only workaround we found so far was to extract the JInput native libraries by hand and set the java.library.path accordingly (e.g. via the -D option to the java interpreter).]