I'm trying to get a working example of calling Java from C using JNI on ubuntu 64bit.
The code from: calling java function from c using jni I am compiling using:
gcc test.c -I/usr/lib/jvm/java-1.7.0-openjdk-amd64/include -I/usr/lib/jvm/java-1.7.0-openjdk-amd64/include/linux -c
gcc test.o -L/usr/lib/jvm/java-1.7.0-openjdk/amd64/jre/lib/amd64/server/ -ljvm -o jniTest
This doesnt generate any errors but if I try ldd jniTest I get the following:
linux-vdso.so.1 => (0x00007fffe55d5000)
libjvm.so => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f85f2928000)
/lib64/ld-linux-x86-64.so.2 (0x00007f85f2d0a000)
And if I try ./jniTest it gives this error:
test.o: In function `create_vm':
test.c:(.text+0x35): undefined reference to `JNI_CreateJavaVM'
collect2: error: ld returned 1 exit status