JNI_CreateJavaVM FAILS
843829Jul 14 2004 — edited Jul 14 2004I am having trouble invoking the java VM in VC++...
It is unable to create the VM and returns -858993460
here is my C++ code, sorry if this is broad, I am pretty new to using JVM.
void CTestingJVMApp::mainTest() {
JNIEnv *env;
JavaVM *jvm;
JDK1_1InitArgs vm_args;
jint res;
jclass cls;
jmethodID mid;
jstring jstr;
jobjectArray args;
char classpath[1024];
/* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
AfxMessageBox(USER_CLASSPATH);
AfxMessageBox(classpath);
/* Append USER_CLASSPATH to the end of default system class path */
//sprintf(classpath, "%s%c%s",
// vm_args.classpath, PATH_SEPARATOR, USER_CLASSPATH);
vm_args.classpath = USER_CLASSPATH;
AfxMessageBox(vm_args.classpath);
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM\n");
AfxMessageBox("Unable to create JVM.");
exit(1);
}