Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]
java.lang.IllegalStateException: Cannot find any joysticks!
at jme3test.input.TestJoystick.simpleInitApp(TestJoystick.java:49)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
For whatever reason, Joysticks are not being detected on your system. This is down at the JInput level and not really something we have direct control over. We asked JInput for a list of joysticks and it returned: none
@limwerks said:
JInput does not support joystick??! :-o
The is the end of my evaluation of jMonkeyEngine. :facepalm:
I didn’t say that. I said it’s not detecting joysticks on YOUR system. I’ve used 10 different joysticks on my system… sometimes at the same time. It even detects the arrow pads on my drawing tablet.
I have no idea why it won’t detect joysticks on YOUR system, though.
But I can’t figure out how to fix it. Is it a bug?
That thread is really old but looks like ultimately joystick support wasn’t being turned on in his app. The joystick test specifically does turn it on, though.
As a test to see if your gamepads are there and just being detected strangely by JInput, you could run some JInput using code directly:
[java]
ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment();
Controller[] cs = ce.getControllers();
[/java]
And then see what’s in that array. JME skips anything reported as a keyboard or a mouse. It also skips anything with no axes… but will log that at FINE level.
I add the following lines to the BasicGame project:
[java]
import net.java.games.input.*;
public static void main(String[] args) {
Main app = new Main();
app.start();
ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment();
Controller[] cs = ce.getControllers();
}
[/java]
Then I got the following error in output window:
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
java.lang.UnsatisfiedLinkError: no jinput-dx8_64 in java.library.path
net.java.games.input.DirectAndRawInputEnvironmentPlugin is not supported
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at net.java.games.input.DirectInputEnvironmentPlugin$1.run(DirectInputEnvironmentPlugin.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.DirectInputEnvironmentPlugin.loadLibrary(DirectInputEnvironmentPlugin.java:67)
at net.java.games.input.DirectInputEnvironmentPlugin.<clinit>(DirectInputEnvironmentPlugin.java:109)
at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init>(DirectAndRawInputEnvironmentPlugin.java:45)
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:526)
at java.lang.Class.newInstance(Class.java:374)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at mygame.Main.main(Main.java:22)
java.lang.UnsatisfiedLinkError: no jinput-raw_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at net.java.games.input.RawInputEnvironmentPlugin$1.run(RawInputEnvironmentPlugin.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.RawInputEnvironmentPlugin.loadLibrary(RawInputEnvironmentPlugin.java:67)
at net.java.games.input.RawInputEnvironmentPlugin.<clinit>(RawInputEnvironmentPlugin.java:109)
at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init>(DirectAndRawInputEnvironmentPlugin.java:46)
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:526)
at java.lang.Class.newInstance(Class.java:374)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at mygame.Main.main(Main.java:22)
I wonder what cause the error “no jinput-dx8_64 in java.library.path” and “no jinput-raw_64 in java.library.path”, may the environment or sdk setting problem?
You can’t do that in main. You would have to do that in simpleInit() or something. A lot of the stuff hasn’t been setup properly until simpleInit() is called… including extracting the native libraries.
Then I add the same setting to JmeTests, but I still got the dll not found in TestChooser.
Then I run the TestJoystick.java file directly, this time the program detect my joystick. I run the TestChooser again and works, it works even I remove the VM Options:
I delete the JmeTests project and folders, recreate a new JmeTests project, this time the SDK automatically extract the jinput-dx8_64.dll and jinput-raw_64.dll in the project root folder. It can detect my joystick.
Open the jar archive, I use 7zip, in the native\windows folder, you can find the jinput dlls, extract the dll to your project root folder, your program can detect joystick now.
It is strange that other native dll like lwjgl and OpenAL are extracted by the SDK but not jinput, which contain in the same archive. This is very confusing for new user.
Especially since for everyone else it seems to work ok. This is what I get just by running my apps:
jinput-dx8.dll
jinput-raw.dll
lwjgl.dll
OpenAL32.dll
I tested on Windows Vista 64-bit and Windows 8.1 Pro 64-bit.
For fresh SDK installation, a project require joystick will not run because missing jinput dlls.
But after doing the workaround (extract the dll manually once), every new project require joystick will have the proper dll in project root folder. Very strange.
@pspeed : I also have 64 bit Windows and it also doesn’t work on my system. @limwerks : Thanks for the solution. I’m going to try it out when I have time.
@limwerks@pspeed
After some time, I think I know what fixed the problem.
I added a . by the working directory in the project properties.
After that the program found the DLL’s.
Then I removed the . and than it still worked.
I looks like the program has to find the DLL’s once and than it works everytime.
Hopefully this is useful for anyone.