I am trying to create a native application, that invokes a JVM. It compiles fine now, but doesn’t execute. When I try to execute the resulting native executable “tester.exe”, it fails with the following message:
Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries
I have no idea, what dependent libraries are missing and how I can tell the program to find them.
This is the code of the native program:
JavaVM* jvm; // denotes a Java VM
JNIEnv* env; // pointer to native method interface
JavaVMInitArgs vm_args; // JDK/JRE 6 VM initialization arguments
JavaVMOption* options = new JavaVMOption[1];
//options[0].optionString = "-Djava.library.path=C:\\Programme\\Java\\jre6\\bin;.;C:\\WINDOWS\\Sun\\Java\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:/Programme/Java/jre6/bin/client;C:/Programme/Java/jre6/bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem";
//options[0].optionString = "-Djava.library.path=C:\\Programme\\Java\\jre6\\bin";
options[0].optionString = "-Djava.class.path=D:\\rfdynhud.jar";
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = false;
// load and initialize a Java VM, return a JNI interface pointer in env
JNI_CreateJavaVM( &jvm, (void**)&env, &vm_args ); // This is where the program exists with exit code 1. The Process is terminated here. The next line won't be executed.
//printf( "%u\n", ret );
//if ( ret == 0 )
return;
//delete options;
// invoke the Main.test method using the JNI
//jclass cls = env->FindClass( "net/ctdp/rfdynhud/RFDynHUD" );
//jmethodID mid = env->GetStaticMethodID( cls, "dumpSomething", "(I)V" );
//env->CallStaticVoidMethod( cls, mid, 123 );
// We are done.
//jvm->DestroyJavaVM();
Any clues? I am completely lost.
Marvin