1
votes

I follow this JNI ref to call c function from java.

In final step, I got follow error msg after I type java hellojni :

Exception in thread "main" java.lang.UnsatisfiedLinkError: no helloJni in

java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)

at java.lang.Runtime.loadLibrary0(Runtime.java:870)

at java.lang.System.loadLibrary(System.java:1122)

at HelloJni.(HelloJni.java:13)

I try to set up the java.library.path, so I type java -Djava.library.path=. HelloJni

But this not works for me, I still got same error message.

Also, I try export LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/sybase/IQ-16_0/jim_samples/udf/hellojni, but is still no work.

1
did you load the library in your Helloxxxx.java static { System.loadLibrary("Helloxxxx"); }kuhajeyan

1 Answers

1
votes

This seems like path issue, where your libhellojni.so is not found in "sybase/IQ-16_0/jim_samples/udf/hellojni" directory.

Remember 'lib' prefix is important in your xxx.so file (if you are running this in Linux), just hellojni.so will not work.