how to set java library path for processing
Before System.loadLibrary("")
, use the following code to check you java.library.path
System.out.println(System.getProperty("java.library.path"));
Generally, the java.library.path
=/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
Provides several options for:
$ sudo cp libxxx.so /usr/lib/jni
java -Djava.library.path=_path of so_ xxx
In Eclipse, I did this to get OpenCV working:
- In the Run menu, select Run Configuration.
- Go to the (x)=Arguments tab of your sketch.
Add this in the VM arguments field:
-Djava.library.path="/path/to/OpenCV/library"
Your library.path
is fine, what you need to do is to drop prefix lib
and suffix .so
from your System.loadLibrary( "..." )
. On Linux or "linux-android" those will be automatically added by JVM.
You can set it on the command line thus:
java -Djava.library.path=... <existing arguments (classpath, name of class to run etc.)>
and point it to the directory containing the relevant library.