B
Bruce
hi,
I have a JNI program which runs correctly on windows XP jdk1.4.2_07.
But when I port the program to Sparc blade 100 Solaris 10, I get a
error when invoking the jvm. the jdk on solaris is jdk1.5.0_01. The
code is as follows:
I gdbed the program and know the code goes into JNI_VERSION_1_2 branch
and error occurs at JNI_createJavaVM. This piece of code rans correctly
on windows xp.
int InvokeJVM( JVM *jvm, const char *classpath )
{
jint res = 0;
#ifdef JNI_VERSION_1_2
JavaVMInitArgs vm_args;
JavaVMOption options[2];
char cpath[1024];
memset( cpath, 0, sizeof(cpath));
sprintf( cpath, "-Djava.class.path=%s", classpath );
options[0].optionString = cpath;
options[1].optionString = "-Xmx64m";
memset( &vm_args, 0, sizeof( vm_args ));
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 2;
vm_args.ignoreUnrecognized = JNI_FALSE;
/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), (void**)&(jvm->jenv),
&vm_args ); // error invoking
#else
JDK1_1InitArgs vm_args;
char classpath[1024];
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs( &vm_args );
sprintf( classpath, "%s%c%s",
vm_args.classpath, PATH_SEPARATOR, &vm_args);
vm_args.classpath = classpath;
/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), &(jvm->jenv), &vm_args);
#endif
if ( res < 0 ) {
fprintf( stderr, "error invoking java VM with code: %d\n", res );
}
return res;
}
Any comments?
-Bruce
I have a JNI program which runs correctly on windows XP jdk1.4.2_07.
But when I port the program to Sparc blade 100 Solaris 10, I get a
error when invoking the jvm. the jdk on solaris is jdk1.5.0_01. The
code is as follows:
I gdbed the program and know the code goes into JNI_VERSION_1_2 branch
and error occurs at JNI_createJavaVM. This piece of code rans correctly
on windows xp.
int InvokeJVM( JVM *jvm, const char *classpath )
{
jint res = 0;
#ifdef JNI_VERSION_1_2
JavaVMInitArgs vm_args;
JavaVMOption options[2];
char cpath[1024];
memset( cpath, 0, sizeof(cpath));
sprintf( cpath, "-Djava.class.path=%s", classpath );
options[0].optionString = cpath;
options[1].optionString = "-Xmx64m";
memset( &vm_args, 0, sizeof( vm_args ));
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 2;
vm_args.ignoreUnrecognized = JNI_FALSE;
/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), (void**)&(jvm->jenv),
&vm_args ); // error invoking
#else
JDK1_1InitArgs vm_args;
char classpath[1024];
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs( &vm_args );
sprintf( classpath, "%s%c%s",
vm_args.classpath, PATH_SEPARATOR, &vm_args);
vm_args.classpath = classpath;
/* Create the Java VM */
res = JNI_CreateJavaVM( &(jvm->jvm), &(jvm->jenv), &vm_args);
#endif
if ( res < 0 ) {
fprintf( stderr, "error invoking java VM with code: %d\n", res );
}
return res;
}
Any comments?
-Bruce