I'm trying to run java code from C using code taken from here. The code that attempts to run JVM is as follows:
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options;
options.optionString = "-Djava.class.path=D:\\Java Src\\TestStruct";
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 1;
vm_args.options = &options;
vm_args.ignoreUnrecognized = 0;
int ret = JNI_CreateJavaVM(jvm, (void**)&env, &vm_args);
The code compiles fine however, when I try to execute it I get the following error:
Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries
Looking at this question I used dependency walker to find out which binaries I'm missing. It turns out I'm missing ieshims.dll
and wer.dll
from my computer which according to this the mentioned dlls are used in vista and above (I'm on XP).
So several questions come to my mind:
- How do I get rid of this?
- Why am I getting this error in the first place? Can't I load JVM in XP?
I'm on Windows XP, using Visual Studio 2008, JDK 1.7 installed (tried with 1.6 too).