#include
#include
JNIEnv* create_vm() {
JavaVM* jvm;
JNIEnv* env;
JavaVMInitArgs args;
JavaVMOption options[1];
I am putting the work around found on other SO posts..
I used straight forwardly this - "
gcc -g -I /usr/lib/jvm/java-6-sun-1.6.0.26/include -I /usr/lib/jvm/java-6-sun-1.6.0.26/include/linux -L /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/server -ljvm CallJVM.c and a.out was created. Then I need to link it with libjvm.so present in server folder as mentioned in post.
A very beautiful explanation has been put up here
I noticed the different ways of implementing in C and C++ but I think I am writing it correctly.
You are using the C variant, but are compiling with g++, which invokes the C++ compiler (even if your source file has a .c extension).
Either change the C variants like
(*env)->FindClass(env, ...)
to the C++ variants, like
env->FindClass(...)
or switch your compiler to gcc to compile the source as C code.