Jinput test wont run on linux 64bit

Hi everybody :slight_smile: I’m kind of new to Java, and have wrote some basic apps so I was thinking of trying jinput but i cannot even get the test run :S. I’m using kubuntu 64 bit and java version 1.6.0_18. Can you people please help me?

[quote]alan@alan-desktop:~/Downloads/Pkg/dist$ sudo java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerTextTest
[sudo] password for alan:
Controller Env = net.java.games.input.DefaultControllerEnvironment@55fdc96c
Dec 13, 2010 9:35:52 PM net.java.games.input.DefaultControllerEnvironment getControllers
INFO: Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.ClassCastException: net.java.games.input.LinuxMouse cannot be cast to net.java.games.input.LinuxAbstractController
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:256)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:160)
at net.java.games.input.test.ControllerTextTest.(ControllerTextTest.java:54)
at net.java.games.input.test.ControllerTextTest.main(ControllerTextTest.java:86)
alan@alan-desktop:~/Downloads/Pkg/dist$ java -version
java version “1.6.0_18”
OpenJDK Runtime Environment (IcedTea6 1.8.1) (6b18-1.8.1-0ubuntu1)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)
alan@alan-desktop:~/Downloads/Pkg/dist$ uname -r
2.6.32-24-generic
alan@alan-desktop:~/Downloads/Pkg/dist$
[/quote]

Hi

I’m not sure how you have managed that. It sounds like the classes were compiled with different compilers or something, LinuxMouse extends Mouse which extends AbstractController, so it can be cast.

Are you using a downloaded binary, or did you compile it yourself?, if you downloaded it, which binary did you get?

Thanks

Endolf

I downloaded this binaries: http://www.newdawnsoftware.com/resources/jinput/jinput_nightly_20100503.zip

at the document and files page: https://jinput.dev.java.net/servlets/ProjectDocumentList?folderID=0&expandFolder=0&folderID=0

Thanks

EDIT:

I forgot to copy the libraries to the proper folder and set the environment variable. I already downloaded Jutils and placed it both in the dist folder and the libraries folder. However, the tests continue to work improperly. ControllerReadTest Opens a blank window but ControllerTextTest and RumbleTest won’t even run. Here’s a copy of my command:

[quote]alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ sudo java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerTextTest
Controller Env = net.java.games.input.DefaultControllerEnvironment@24a20892
Dec 14, 2010 11:04:33 PM net.java.games.input.DefaultControllerEnvironment getControllers
INFO: Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.ClassCastException: net.java.games.input.LinuxMouse cannot be cast to net.java.games.input.LinuxAbstractController
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:256)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:160)
at net.java.games.input.test.ControllerTextTest.(ControllerTextTest.java:54)
at net.java.games.input.test.ControllerTextTest.main(ControllerTextTest.java:86)
alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ sudo java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.RumbleTest
Dec 14, 2010 11:04:59 PM net.java.games.input.DefaultControllerEnvironment getControllers
INFO: Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.ClassCastException: net.java.games.input.LinuxMouse cannot be cast to net.java.games.input.LinuxAbstractController
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:256)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:160)
at net.java.games.input.test.RumbleTest.(RumbleTest.java:21)
at net.java.games.input.test.RumbleTest.main(RumbleTest.java:69)
alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ ls
jinput-dx8_64.dll jinput-dx8.dll jinput.jar jinput-raw_64.dll jinput-raw.dll jinput-test.jar jinput-wintab.dll jutils.jar libjinput-linux64.so libjinput-linux.so libjinput-osx.jnilib
alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ ls $LD_LIBRARY_PATH
jutil.jar jutils.jar libjinput-linux64.so libjinput-linux.so libjinput-osx.jnilib
alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$
[/quote]
My joypad is already pluggin in, btw :stuck_out_tongue: And Linux recognizes it correctly, it works alright.

On sun java 1.6.0_13 it works fine, I downloaded that build to test it. I have no idea if this is something that openjdk has made fail. Can you try a sun 1.6 jdk?, if it works on that then we know something has changed with openjdk that needs looking at, if it fails there to then it is something in your environment making it fail.

I think debian or ubuntu has started to include jinput as one of it’s installable packages, maybe that is conflicting somewhere?

Endolf

It is highly probable, they do the same for JOGL.

It’s something in my environment. I installed sun’s jdk and still, doesn’t run. It gives me pretty much the same error:

alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ sudo /usr/lib/jvm/java-6-sun/jre/bin/java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerTextTest
Controller Env = net.java.games.input.DefaultControllerEnvironment@7ca83b8a
Dec 24, 2010 12:45:23 PM net.java.games.input.DefaultControllerEnvironment getControllers
INFO: Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.ClassCastException: net.java.games.input.LinuxMouse cannot be cast to net.java.games.input.LinuxAbstractController
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:256)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:160)
at net.java.games.input.test.ControllerTextTest.(ControllerTextTest.java:54)
at net.java.games.input.test.ControllerTextTest.main(ControllerTextTest.java:86)
alan@alan-desktop:~/Downloads/Pkg/Jinput/dist$ sudo /usr/lib/jvm/java-6-sun/jre/bin/java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerReadTest
Dec 24, 2010 12:47:35 PM net.java.games.input.DefaultControllerEnvironment getControllers
INFO: Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.ClassCastException: net.java.games.input.LinuxMouse cannot be cast to net.java.games.input.LinuxAbstractController
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:256)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:160)
at net.java.games.input.test.ControllerReadTest.(ControllerReadTest.java:252)
at net.java.games.input.test.ControllerReadTest.main(ControllerReadTest.java:301)

I don’t have a clue of what it might be though ??? Is there something else I should check? BTW, I looked for jinput and it is in the repositories but only for 10.10, I’m using 10.04

Look at the list of packages in Synaptic.

I have already checked, It’s the first thing I did after I visited the Jinput page! But as I said, there isn’t a Jinput build for Karmic, just for Maveric.

It works on my linux 64 bit system, so it must be environmental, but I have no idea what, it doesn’t make sense unless there are some over versions of the class files somewhere.

Endolf