MeenuNagpal
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.UnsatisfiedLinkE rror: no prospect_jpcam in java.library.path
at java.lang.ClassLoader.load Library(Cl assLoader. java:1681)
Following is the value of System.getProperty("java.l ibrary.pat h")
java.library.path /usr/lib/jvm/java-6-openjd k/jre/lib/ i386/clien t:/usr/lib /jvm/java- 6-openjdk/ jre/lib/i3 86:/usr/li b/jvm/java -6-openjdk /jre/../li b/i386::/u sr/lib/jvm /java-6-su n:/home/ad ministrato r/cambuild :/usr/java /packages/ lib/i386:/ usr/lib/jn i:/lib:/us r/lib
and the file prospect_jpcam.so exist in following directory :/home/administrator/cambu ild
java.lang.UnsatisfiedLinkE
at java.lang.ClassLoader.load
Following is the value of System.getProperty("java.l
java.library.path /usr/lib/jvm/java-6-openjd
and the file prospect_jpcam.so exist in following directory :/home/administrator/cambu
java -Djava.library.path=/home/ administra tor/cambui ld ....
Here is another way to set java.library.path
http://blog.cedarsoft.com/2010/11/setting-java-library-path-programmatically/
http://blog.cedarsoft.com/2010/11/setting-java-library-path-programmatically/
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
Example:
extern "C" {
void func1();
void func2();
}
Google: extern "C" for explanations
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.