try but surely cannot solve the problem.
Main Topics
Browse All TopicsI write a simple java hello world program with JNI. The java code and c code can be found in the code section. The program can be run at Windows environment successfully. However, I fail to run it at Red Hat 3.4.6-8. I use the following command to compile the c library.
gcc -o testnativelib.so -shared -fPIC -I$JAVA_HOME/include -I$JAVA_HOME/include/linux
When I run the program, the follow error is resulted.
>java JNITester abc
java.library.path is: /home/abc/temp/example
Exception in thread "main" java.lang.UnsatisfiedLinkE
at java.lang.ClassLoader.load
at java.lang.Runtime.loadLibr
at java.lang.System.loadLibra
at com.cargosmart.mcci.test.J
the testnativelib.so is at /home/abc/temp/example. And I have run the command LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH
Do you have any idea on the problem?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
surely it can. when you pass "testnativelib" to the loadLibrary function on a unix-based system, Java prepends "lib" and a platform-specific suffix (.so in this case) in order to find the actual filename on disk. So if your library is not named "libtestnativelib.so", it will not be found.
This differs slightly from the behavior on windows, where the suffix is ".dll" and there is no library prefix.
Business Accounts
Answer for Membership
by: objectsPosted on 2009-02-25 at 00:30:00ID: 23731369
try changing your so filename to libtestnativelib.so