it is my first time to use Jinput, and i can compile ControllerReadTest.java,but when i run it.
it comes exception :
java.lang.UnsupportedClassVersionError: net/java/games/util/plugins/Plugins (Unsupported major.minor version 49.0)
so what is problem?
thx in advance.
Hi
This means that you used jdk 1.5 to compile the code, but are trying to run it on jdk 1.4 or less.
Check which jdk javac is from, and check your path variable to check which jre it’s in.
All the binaries on the jinput.dev.java.net should be 1.4 now after Kevglass pointed out that I had built them with 1.5
HTH
Endolf
ok,i have tried some other versions,but new problems occurs:
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Examining file : net/java/games/input/DirectInputRumbler.class
OS name is: Windows XP
DX8 plugin is supported
java.lang.UnsatisfiedLinkError: no jinput-dxplugin in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at net.java.games.input.DirectInputEnvironmentPlugin.(DirectInputEnvironmentPlugin.java:62)
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:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(DefaultControllerEnvironment.java:208)
at net.java.games.input.DefaultControllerEnvironment.scanControllers(DefaultControllerEnvironment.java:189)
at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultControllerEnvironment.java:58)
at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControllerEnvironment.java:109)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:107)
at ControllerReadTest.(ControllerReadTest.java:18)
at ControllerReadTest.main(ControllerReadTest.java:80)
Exception in thread “main”
endolf could you tell me what is the problem?
thx
Hi
Thats an easy one, and common. The native library can’t be found, make sure you add -Djava.library.path= to your start script/command
HTH
Endolf
i use the jre of 1.50,and get your recently release of Jinput.
and it works now,since i felt depressed and exhausting these days,now i feel better.
endolf,thanks for you help and your work on Jinput
endolf
sorry to bother you again.
is there some Jinput API Specification? which tells what the classes mean and how the methods work.
if there is some,could you post it?
thanx a lot
There are Javadocs in the code.
Thats about it outside of the brief readmes.
There are also some examples around if you look through the threads here.
Hi
Sorry for the delay in replying, was busy getting married
Basic rundown
Get the ControllerEnvironment by calling getDefaultEnvironment(), this gives you the plugin for the environment. From that you can get your controllers
A controller in jinput is not just a device like a joystick/mouse/keyboard/gamepad, but may also be some part of a device. For example, there maybe a controller instance to represent a mouse, but this may have no components, it may be that it has instead 2 sub controllers, one for the ball, and one for the buttons.
A Component is an axis, a button, or a key. From the components you can get information about the component, like the value, whether it’s absoulte or relative, if it’s boolean or analog etc etc.
You must remember to poll the controllers, I recommend polling at least 50 times a second. If you don’t poll frequently enough, you will fill up the underlying buffers and start losing input events.
HTH a little
Endolf
Hey hey! Congrats! Gonan post pictures?
Really? Thats ugly. Is that in the general Java code as opposed to to the plug-ins? If so do we want to thin kabout replacing them with ring-buffers?
JK
wow~~~congratulations for your marry!
so i can guess you will be abscent here for some days,and have a nice honey-moon
and jeff, i cant see the javadoc in my downloading files.could you give some valid link? thx
Hi
Pictures will no doubt appear at some point yes
The honey moon is in november, so you have me till then i’m afraid
The buffer problem is a directx issue, we can increase the buffer size as it’s creation is controlled by the plugin, but the implementation isn’t controllable, just it’s size.
The javadoc can be got from the jinput site in the files section.
Endolf
so, why your honey moon is postponed to november :-
another question.
my OS is a chinese system.when i used the controller.getName( ) and component.getName( ),i just can get some disorder code.
how can i resolve this problem?
Hi
The honeymoon is in november because we have other things going on this month
The jinput package has in it some tests. Could you run net.java.games.input.test.ControllerTextTest for me? (it’s in the jinput.jar)
Please either post the whole output, or put it on a website and link to it. I have an idea, but I’d like to check
Thanks
Endolf
This is the output:
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Examining file : net/java/games/input/DirectInputRumbler.class
OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating BETOP C318 polling = true
Component count = 3
Component count = 5
Component count = 124
Component count = 11
This is the output:
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Examining file : net/java/games/input/DirectInputRumbler.class
OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating BETOP C318 polling = true
Component count = 3
Component count = 5
Component count = 124
Component count = 11
Create effect : DIERR_INVALIDPARAM
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
DI_BUFFEROVERFLOW
Interactive Session Ended