gcj: issue with run time library loading

Vaijayanthi Mala Suresh vaijayanthimalas@gmail.com
Thu May 21 08:41:00 GMT 2009


Hi,

I am trying to use JNI calls using gcj.

Hello.java is the jave code having a native method.

gcj -c -fjni Hello.java -o MyApp.o
gcjh Hello -o MyApp.h
ar -rcs libHello.a MyApp.o

Hello.c contains the native code implementation
gcjh -jni Hello
g++ -c Hello.c
ar rcs libNative.a Hello.o


I have a test.cpp where I have initialized the JVM and I am trying to
invoke a method in the Java code which inturn invokes the native
method. I have linked the above libraries along with test.o

I am getting the following error

Unhandled Java exception:
java.lang.UnsatisfiedLinkError: natPrint
   <<No stacktrace available>>

Can anyone help me to resolve this problem.

Thanks
Mala



More information about the Java mailing list