1

While compiling a demo from openni i stumbled across this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no OpenNI.jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at org.OpenNI.NativeMethods.<clinit>(NativeMethods.java:34)
at org.OpenNI.Context.initFromXmlEx(Context.java:317)
at org.OpenNI.Context.createFromXmlFile(Context.java:36)
at kitouch.UserTracker.<init>(UserTracker.java:113)
at kitouch.UserTrackerApplication.main(UserTrackerApplication.java:46)
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)

I'm doing this on my mac . And my best guess is that this file libOpenNI.jni.dylib is not in my java.library.path

My question now is: Is this guess right, and how do i add libOpenNI.jni.dylib to my java.library.path in netbeans.

Thx in advance

Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
  • Nvm found it ... i really should learn to browse the interwebs longer. The answer is : add this to VM option of the projects property: -Djava.library.path=/Users/olivierjanssens/Development/Kinect/OpenNI/Lib/ this is where the dylib file is – Olivier_s_j Dec 02 '11 at 20:24
  • If you've found the solution, please add it as an answer. – Andy Thomas Dec 02 '11 at 20:45
  • It might also just work if that file were in the project's base directory. – BillRobertson42 Dec 02 '11 at 23:40

1 Answers1

5

add this to VM option of the projects property: -Djava.library.path=/Users/olivierjanssens/Development/Kinect/OpenNI/Lib/

this is where the dylib file

Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
  • Also make sure that you're using a JVM with the corresponding architecture. That is, if you're using OpenNI x64 you should also use a 64 bit java version. – Tiago Alves May 09 '12 at 15:01
  • Its working now. http://stackoverflow.com/questions/10714785/giving-java-library-path-in-netbeans-for-dll-so-files/11898261#11898261 – JDGuide Aug 10 '12 at 08:52