jinput plugin error

i’m using mind2machine compiled binary of jinput.

i get error with following code


ControllerEnvironment ce =
                  ControllerEnvironment.getDefaultEnvironment();
            Controller[] ca = ce.getControllers();
            for (int i = 0; i < ca.length; i++)
            {
                  Controller cont = ca[i];
                  System.out.println(cont.getName());
            }

and error is


java.lang.NullPointerException
        at net.java.games.util.plugins.Plugins.scanPlugins(Plugins.java:78)
        at net.java.games.util.plugins.Plugins.<init>(Plugins.java:73)
        at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(D
efaultControllerEnvironment.java:170)
        at net.java.games.input.DefaultControllerEnvironment.scanControllers(Def
aultControllerEnvironment.java:162)
        at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultC
ontrollerEnvironment.java:57)
        at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultContro
llerEnvironment.java:108)
        at java.security.AccessController.doPrivileged(Native Method)
        at net.java.games.input.DefaultControllerEnvironment.getControllers(Defa
ultControllerEnvironment.java:106)

what’s causing this?

i’m currently trying to build jinput with mingw but the project main page say’s that i need dx8lib’s but doesn’t say where to put them,also i’m quite lost how to get the native code to build,root ant build file doesn’t do that.

Put PeterPuck’s librarys in the MinGW lib directory. Ill check my system at work today and give you and exact path.

The Ant file should build the DLL under MinGW(it does for me…) If you are going to use a different environment you will likely have to muck with it.

BTW…

At a guess this is ocurring because you don’t have a controller
directory that contains the plugin beneath your execution directory and/or in your /lib directory.

Having said that it should fail more gracefully.
I’ll look at the plug-in code and see about fixing that.

JK

Yep. Definiately needed some improvement in its error handling.

Upate coming tomorrow after I make sure everything still works.

JK

Okay.

New version is up that will ignore a missing “controller” plug-in directory and just run with the built in support. (Which in this case is a null set, I believe.)