Link to home
Start Free TrialLog in
Avatar of MeenuNagpal
MeenuNagpalFlag for United States of America

asked on

Set LD_LIBRARY_PATH in Linux

I have exported the LD_LIBRARY_PATH to the library where my *.so file exist but still I am getting following exception

java.lang.UnsatisfiedLinkError: no prospect_jpcam in java.library.path
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)

Following is the value of System.getProperty("java.library.path")
java.library.path /usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386::/usr/lib/jvm/java-6-sun:/home/administrator/cambuild:/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib

and the file prospect_jpcam.so exist in following directory  :/home/administrator/cambuild
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

java -Djava.library.path=/home/administrator/cambuild ....
Avatar of CEHJ
What are you doing in your code?
Yeah - we need to see some source code -- especially the part where you are loading your library.
Make sure you're calling loadLibrary() and not load(). The latter expects the actual filename, whereas the former just expects the library name
If you built your library with C++ this may occur. Make sure to build it with C, or to expose the lib functions with extern "C" convention or Java won't see it due to C++ name mangling.

Example:

extern "C" {

   void func1();
   void func2();

}


Google: extern "C" for explanations
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial