OSXEnvironmentPlugin is not supported?

Hello.

I’m trying to use my PS3 Controller with Java and jinput. I downloaded the files and ran the

java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerReadTest

test application. And it worked fine. Now I use the same source code in my eclipse project but it doesn’t work.

I get the message:
Loading: net.java.games.input.OSXEnvironmentPlugin
java.lang.UnsatisfiedLinkError: /Users/…/lib/libjinput-osx.jnilib:
net.java.games.input.OSXEnvironmentPlugin is not supported
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at net.java.games.input.OSXEnvironmentPlugin$1.run(OSXEnvironmentPlugin.java:78)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.OSXEnvironmentPlugin.loadLibrary(OSXEnvironmentPlugin.java:70)
at net.java.games.input.OSXEnvironmentPlugin.(OSXEnvironmentPlugin.java:110)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:156)
at sailworld.RobSailer.main(RobSailer.java:42)

The jar file as well as the native libraries are included in the class path and the libjinput-osx.jnilib file is at the position, where the jvm cannot find it.

Can someone help me to get this run?

Thanks CueMex

Edit:
I have a Mac OS X System with an Intel processor

This is just saying that your project isn’t set up correctly and it can’t find the native. Either set the natives in the properties of the jinput.jar, or pass that -Djava.library.path flag as a runtime VM arguement in the run settings.

HTH

Endolf

Editing your post after I respond doesn’t help me figure out what you changed :slight_smile:

You say the jar is on the classpath. That’s ok, the binary being on the classpath is irrelevant as natives can only be loaded from java.library.path or lib/ext in the jre if I remember correctly. The location that it’s failing to load from is /lib/ in the root of your file system. Is that really where you put the native file?

HTH

Endolf

Thank you for the answer.

But i tried the Djava.library.path flag, than the jvm searches the native lib in the given path but cannot find it anyway. I tried pathes without spaces like: /User/bla/Desktop insted of /User/bla/Documents/Projekt - RobSailer/ but it still isn’t working. I had also set up the native directory for the jar and it still isn’t working.

With Windows it is no problem to set up the native lib.

More help?

Thx
CueMeX

Now I tried to put the libjinput-osx.jnilib in the path /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ where all the other native libraries are. I removed the the information in the eclipse project where to find the native lib. When i then started the application. i got the following message:

java.lang.UnsatisfiedLinkError: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjinput-osx.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1723)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at net.java.games.input.OSXEnvironmentPlugin$1.run(OSXEnvironmentPlugin.java:78)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.OSXEnvironmentPlugin.loadLibrary(OSXEnvironmentPlugin.java:70)
at net.java.games.input.OSXEnvironmentPlugin.(OSXEnvironmentPlugin.java:110)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:156)
at sailworld.util.SailInputPad.(SailInputPad.java:20)
at sailworld.RobSailer.main(RobSailer.java:36)

I think that means, that the native lib was found. Are there other dependencies?

CueMeX

Hm.
Now I put the jar and the native lib in the directories of my javavm.
When i export my application to a jar file and start it it works.
But i have to export it, i cannot start the application out of eclipse.

Thanks for the posts. I can live with this solution.
If anyone knows why there is a problem with eclipse, i am thankful. But it works now.

CueMeX

Hi

I’m still a bit puzzled by this. I’m not a mac user normally, but have one for building JInput. It seems to work ok there. I’m glad you have a method that works for you.

Cheers

Endolf