Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI - Error when loading library: ...no <library_name> in java.library.path

843829Jun 17 2003 — edited Jun 19 2003
Hi,

I'm trying to call c function from java using JNI
I've tried to run the simple example in the JNI Documentation
(http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html I modified a little bit the code)

I made the following compiling steps:
1) javac myjavafile.java --> the file compiled successfully

2) javah -jni myjavafile --> the file myjavafile.h was created successfully

3) cc -G mycfile.c -o libmylib.so --> an error:
/usr/ccs/bin/ld: Unsatisfied symblos: main (code)
although the error, the file libmylib.so has been created

4) java myjavafile --> Exception in thread "main" java.lang.UnsatisfiedLinkError: no mylib in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at myjavafile.<clinit>(myjavafile.java:12)

This happend although I set the LD_LIBRARY_PATH to include the path to my .so file

i'm stuck on this more than two days, so any help will be very appriciated

Thanks,
Alon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2003
Added on Jun 17 2003
8 comments
979 views