>>>>> Pierre Héroux writes:

    Pierre> I use JDK1.2.2 RC2 on RedHat 6.1.  The following code
    Pierre> gives a SIGSEGV on JNI_CreateJavaVM.  Could you tell me
    Pierre> where is the problem.

    Pierre> #include <stdlib.h>
    Pierre> #include <iostream.h>
    Pierre> #include <jni.h>

    Pierre> int main(int argc, char **argv)
    Pierre>   {
    Pierre>   JavaVM * jvm;
    Pierre>   JNIEnv * env;

    Pierre>   JavaVMInitArgs vm_args;

Make that 'JDK1_1InitArgs vm_args' or use the 1.2 way of creating a VM
(see 
http://www.blackdown.org/java-linux/docs/support/faq-release/examples/invocation-in-C++/).

    Pierre>   vm_args.version =  0x00010001;
    Pierre>   JNI_GetDefaultJavaVMInitArgs ( &vm_args );

    Pierre>   jint res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
    Pierre>   if (res < 0)
    Pierre>     {
    Pierre>     cerr << "JVM has not started" << endl;
    Pierre>     exit(1);
    Pierre>     }
    Pierre>   cout << "JVM started" << endl;
    Pierre>   jvm-> DestroyJavaVM();
    Pierre>   }


        Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux.html


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to