• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 921
  • Last Modified:

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
0
MeenuNagpal
Asked:
MeenuNagpal
1 Solution
 
wesly_chenCommented:
java -Djava.library.path=/home/administrator/cambuild ....
0
 
wesly_chenCommented:
0
 
CEHJCommented:
What are you doing in your code?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
VenabiliCommented:
Yeah - we need to see some source code -- especially the part where you are loading your library.
0
 
objectsCommented:
Make sure you're calling loadLibrary() and not load(). The latter expects the actual filename, whereas the former just expects the library name
0
 
mrjoltcolaCommented:
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
0
 
objectsCommented:
And it needs to be a jni shared lib, you can't just load any shared lib
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html#gen
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now