I have a sample program, please see below.
This program exe runs fine with JRE 1.4 on AIX 5.2.
But same exe causes core dump with JRE 1.5 on AIX5.2.
Any idea why this should happen?
(I did set all environment variables required - LDR_CNTRL,
AIXTHREAD_SCOPE etc)
Do I need to compile my sample program with JDK 1.5??
Please let me know if anyone has came across such issues with JRE 1.5.
Thanks in advance.
-Abhijit
Sample Program:
============
int main(){
JavaVM *jvm; /* denotes a Java VM */
JNIEnv *env; /* pointer to native method interface */
JavaVMInitArgs vm_args;
JavaVMOption options[5];
char* classpathVar = (char*)"-Djava.class.path=.";
options[0].optionString =
(char*)"-Djava.compiler=NONE";// disable JIT
options[1].optionString = classpathVar;// user classes
options[2].optionString =
(char*) "-Djava.library.path=.";// set native library path
options[3].optionString =
(char*)"-verbose:jni";// print JNI-related messages
options[4].optionString =
(char*)"-Xcheck:jni";// print JNI-related messages
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_FALSE;
/* load and initialize a Java VM, return a JNI interface
* pointer in env */
jint retValue = 0;
retValue = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
cout << "Return value : " << retValue << endl;
/* invoke the Main.test method using the JNI */
jclass cls = env->FindClass("java/lang/string");
//jmethodID mid = env->GetStaticMethodID(cls, "test", "(I)V");
//env->CallStaticVoidMethod(cls, mid, 100);
cout << "Done "<< endl;
/* We are done. */
jvm->DestroyJavaVM();
return 0;
}
> I have a sample program, please see below.
> This program exe runs fine with JRE 1.4 on AIX 5.2.
> But same exe causes core dump with JRE 1.5 on AIX5.2.
>
> Any idea why this should happen?
> jclass cls = env->FindClass("java/lang/string");
You probably mean "java/lang/String" with capital "S".
Otherwise you'll get cls = NULL returned by FindClass(...)
which might well result in a crash in the following lines.
> //jmethodID mid = env->GetStaticMethodID(cls, "test", "(I)V");
> //env->CallStaticVoidMethod(cls, mid, 100);

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
abhijit.dhariya@gmail.com - 31 Mar 2006 21:00 GMT
Thanks for quick reply Thomas.
This is only sample program. Things works fine if I use classes inside
java package.
For any other class inside my jar, FindClass coredumps with JRE
1.5.0,but works
with JRE 1.4.0.
Any clues, why it core dumps??
Thanks,
Abhijit
> > I have a sample program, please see below.
> > This program exe runs fine with JRE 1.4 on AIX 5.2.
[quoted text clipped - 7 lines]
> > //jmethodID mid = env->GetStaticMethodID(cls, "test", "(I)V");
> > //env->CallStaticVoidMethod(cls, mid, 100);