Posted By:
Andrew_Biggs
Posted On:
Wednesday, March 31, 2004 08:35 PM
I am attempting to use JDWP to debug some java code that gets invoked via the JNI invocation interface. The following is the code I use to instantiate the JVM: // create JVM and get vtable pointer (mEnv) JavaVMInitArgs vm_args; JavaVMOption options[5]; options[0].optionString = "-Djava.class.path=" USER_CLASSPATH; options[1].optionString = "-Xdebug"; options[2].optionString = "-Xms32m"; options[3].optionString = "-Xmx48m"; options[4].optionString = "-Xrunjdwp:transport=dt_shmem,server=y,address=foobar,suspend=y"; vm_args.version = JNI_VERSION_1_4; vm_args.options = options; vm_args.nOptions = 5; vm_args.
More>>
I am attempting to use JDWP to debug some java code that gets invoked via the JNI invocation interface. The following is the code I use to instantiate the JVM:
// create JVM and get vtable pointer (mEnv)
JavaVMInitArgs vm_args;
JavaVMOption options[5];
options[0].optionString = "-Djava.class.path=" USER_CLASSPATH;
options[1].optionString = "-Xdebug";
options[2].optionString = "-Xms32m";
options[3].optionString = "-Xmx48m";
options[4].optionString = "-Xrunjdwp:transport=dt_shmem,server=y,address=foobar,suspend=y";
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_TRUE;
jint res = JNI_CreateJavaVM(&sJvm, (void**)&sEnv, &vm_args);
The problem is that the -Xrunjdwp is causing the JNI_CreateJavaVM() method to fail with an "Access Violation" exception (as per the VC++ debugger). I know this only because if I remove the -Xrunjdwp option from the options list, leaving all the others, everything works great. But of course, then I can't debug my app remotely. Anyone else have this problem, or see any glaring flaws in my code here?
BTW - I'm using VC++ 6.0, and Sun's Java 2 SDK 1.4.1_03.
Thanks!
<<Less