JNI_GetCreatedJavaVMs() troubles...

James Lee jlee23@umbc.edu
Sun Jun 26 00:07:00 GMT 2005


Hello,

I have the following function in one my JNI libraries

JNIEnv* GetEnv() {
        JavaVM *jvm;
        JNIEnv *env;

        JNI_GetCreatedJavaVMs(&jvm, 1, NULL);
        (*jvm)->AttachCurrentThread(jvm, (void**) &env, NULL);

        return env;
}

to get a JNIEnv for a non-Java thread to use.  This code worked works well for
me in blackdown-jdk 1.4, and worked well for me when I had GCJ 3.4.  I have
since upgraded to 4.0, and my whole program locks up at the
JNI_GetCreatedJavaVMs function call.  I'm not too sure how to debug it, but it's
definitely not the expected behavior.  Has anyone else come across this?

Thank you,

James Lee
jlee23@umbc.edu



More information about the Java mailing list