My apologies but I was compiling as C++, which does not work for standard C. Modify the code between the lines
typedef jint (CALLBACK *fpCJV)(JavaVM**, void**, JavaVMInitArgs*);
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
hVM = LoadLibrary("C:\\Program Files (x86)\\Java\\jre6\\bin\\client\\jvm.dll");
if (hVM == NULL)
DWORD dwe = GetLastError();
CreateJavaVM = (fpCJV)GetProcAddress(hVM, "JNI_CreateJavaVM");
res = CreateJavaVM(&jvm, (void**)&env, &vm_args);
I have added some extra comment lines preceding the code that requires changing. You may also like to consider moving to C++ which offers lots of benefits over pure C.
We still have the issue of why the linker cannot find the
JNI_CreateJavaVM call, which I may return to as time permits, but at least this solution should allow you to continue working with JNI.
I finally found the time to go and look at this properly, and realised that I have mixed mode libraries on my Windows 7 system. I downloaded the 32bit JDK and now I can link and run successfully. Please check that you are using all 32 bit (from C:\Program Files (x86)\Java) or all 64bit (from C:\Program Files\Java) for your projects.