You don't need to load the libs yourself. The JInput classes load the libs when the classloader creates the class objects, not an instance, so the trick is to set the properties before the class loader gets to them. The most reliable way I have found to do this is through reflection.

Create a launcher class. Do *not* import anything that might touch the jinput classes, except for some logging you might be able to get away with importing nothing at all. In the loader class, set the library path then look up your main class and then call it's main method or how ever you wish you launch it. As long as the library path is set before the class loader looks for an of the jinput classes, it should work fine.

I would have expected that the classloader already has loaded "Thing" in the same way like when referencing the main()-method (since it is static), if you use Thing.class. So I don't see a reason why calling it via reflection makes a difference to calling it directly regarding the "java.library.path" property.

I can't find the relevant doc right now, but the JVM can (must?) do lazy class loading, but I don't know how that varies between implementations. The safest bet is to use class.forname like cylab suggests. On the other hand, I didn't do that in the applet loader tests and it seems to work ok there too.

I can't find the relevant doc right now, but the JVM can (must?) do lazy class loading, but I don't know how that varies between implementations. The safest bet is to use class.forname like cylab suggests. On the other hand, I didn't do that in the applet loader tests and it seems to work ok there too.

HTH

Endolf

Okay I'll switch to forName just incase other people might have a problem

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org