Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI_CreateJavaVM FAILS

843829Jul 14 2004 — edited Jul 14 2004
I 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);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2004
Added on Jul 14 2004
3 comments
282 views