stupid newbie osx question

i have put jinput.jar and jutils.jar in /Library/Java/Extensions and written a simple test:

import net.java.games.input.*;

public class Prova {
public static void main(String args[]) {
Controller[] ctrl = ControllerEnvironment.getDefaultEnvironment().getControllers();
System.out.println(ctrl.length);
for (int i = 0; i<ctrl.length; i++) {
System.out.println(ctrl[i].getName());
}
}
}

but i can’t get any controller…

did i forget anything during installation ?

Hi
There should be a native part too, called libjinput.jnilib under osx i think, and that needs to go somewhere on the java.library.path.

HTH

Endolf

[quote]Hi
There should be a native part too, called libjinput.jnilib under osx i think, and that needs to go somewhere on the java.library.path.
Endolf
[/quote]
i tried to put it in the same folder with jinput.jar and jutils.jar but it doesn’t work anyway…

could some kind osx user tell me where am i wrong ?

greets

Hi
You are currently trying to install jinput into the VM from the sounds of it. I can’t help you with this as I don’t have an OSX box to play with. If you want to get it running on a per application bases you need to have the contents of the OSX plugin in the controller directory. Take a look at the following threads that cover issues to do with controller discovery and plugin locations.

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jinput;action=display;num=1073982000;start=30#31
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jinput;action=display;num=1083219781;start=0#1

HTH

Endolf

/Library/Java/Extensions/controller/libjinput.jnilib
/Library/Java/Extensions/controller/xyz.jar

xyz.jar is the Java part of the plugin (dont know the name).

If your game resides in some directory foo you can also put a controller subdir in foo and put the files in there. This is how it works on the other OSes.

begging for documentation

[quote]/Library/Java/Extensions/controller/libjinput.jnilib
/Library/Java/Extensions/controller/xyz.jar
[/quote]
done…

but my program continues to see 0 controllers… i plugged an apple usb mouse for testing (those funny things with only one button) and i thought it would have worked but it don’t… suggestions ?

what about the second variant? (putting controller dir in application dir) and starting it from there. it may be needed to start the app from a shell because it is necessary that System.getProperty(“user.dir”) points the directory where ‘controller’ is in.

if i put controllers in the same dir of the applications it works correctly… thanks

k, i had a problem earlier, but I now have moved onto this.

I am just trying to run a quick program that will see if I have anything connected, and i get this output:

Scanning jar: HIDWrapper.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/InputController.class
Examining file : net/java/games/input/InputControllerElement.class
Examining file : net/java/games/input/OSXEnvironmentPlugin.class
Found candidate class: net/java/games/input/OSXEnvironmentPlugin.class
Exception in thread “main” java.lang.NoClassDefFoundError: net/java/games/input/ControllerEnvironment
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at net.java.games.util.plugins.Plugins.processJar(Plugins.java:116)
at net.java.games.util.plugins.Plugins.scanPlugins(Plugins.java:8
at net.java.games.util.plugins.Plugins.(Plugins.java:76)
at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(Defa ultControllerEnvironment.java:199)
at net.java.games.input.DefaultControllerEnvironment.scanControllers(Defaul tControllerEnvironment.java:189)
at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultCont rollerEnvironment.java:5
at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControlle rEnvironment.java:109)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.DefaultControllerEnvironment.getControllers(Default ControllerEnvironment.java:107)
at GUI.JoystickInput.main(JoystickInput.java:45)

can any brilliant minds out there give me some advice or an idea of a solution?

thanks, Jason

The path where yo uare putting the plug ins doesnt sound right to me, but the Mac uses a weird-arse java structure.

Can I suggest you try making a controller directory under your working directory and putting everything there just to make sure that much is working?

[quote]k, i had a problem earlier, but I now have moved onto this.

I am just trying to run a quick program that will see if I have anything connected, and i get this output:

Scanning jar: HIDWrapper.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/InputController.class
Examining file : net/java/games/input/InputControllerElement.class
Examining file : net/java/games/input/OSXEnvironmentPlugin.class
Found candidate class: net/java/games/input/OSXEnvironmentPlugin.class
Exception in thread “main” java.lang.NoClassDefFoundError: net/java/games/input/ControllerEnvironment
[/quote]
Thats an odd error. ControllerEnvironment is an abstract class and part of the jinput core code. Whats your classpath look like? Where did you install the jinput jar?

My best geuss off the top of my head is that its not on your classpath but that you somehow launched this code off from a custom class loader and that, when the plug-ins class loader ties to find this core calss by differing to its parent, the cl;asspath classloader, the classpath classloader cant find it.