Um..... I thought he was just asking for help. He posted the code that was
breaking, it's a short snippet, and he was fairly clear about the
environment he was using; that's already more than *most* of the posts I've
seen come across this, and other, mailing lists.
Pierre, I'm running RH5.2 and Blackdown 1.2-pre-v2, and the code compiled (I
had to add the "-I" include directives, though--your g++ command-line below
was missing those, but that would yield a compile-time error, and not a
run-time segfault) and ran without a hitch; I'd check to make sure the JDK
installation itself is good, in case there's some configuration issue at
stake here. (Juergen, I didn't need the LD_BIND_NOW directive to get this to
run--is it really required?)
Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
"I don't even speak for myself; my wife won't let me." --Me
-----Original Message-----
From: William D.Webb <[EMAIL PROTECTED]>
To: Pierre Heroux <[EMAIL PROTECTED]>;
[EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, September 20, 1999 12:27 PM
Subject: Re: [Problem with JNI_CreateJavaVM()]
>Dude, you want us to write the code for you as well??
>
>Pierre Heroux <[EMAIL PROTECTED]> wrote:
>> I have a "Segmentation fault (core dumped)" message when I execute the
>> following source.
>>
>> #include <jni.h>
>> #include <iostream>
>>
>> int main()
>> {
>> const int nOpts = 4;
>> JavaVMOption options[nOpts];
>> int ii=0;
>> options[ii++].optionString = "-Djava.compiler=NONE";
>> options[ii++].optionString = "-Djava.class.path=.";
>> options[ii++].optionString = "-Djava.library.path=.";
>> options[ii++].optionString = "-verbose:jni,class,gc";
>>
>> JavaVMInitArgs vm_args;
>> vm_args.version = JNI_VERSION_1_2;
>> vm_args.options = options;
>> vm_args.nOptions = nOpts;
>> vm_args.ignoreUnrecognized = JNI_TRUE;
>>
>> JavaVM *jvm;
>> JNIEnv *env;
>> jint res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args); /*debugger
>> message : Program received signal SIGSEGV, Segmentation fault.
>> 0x401d5ca8 in main_arena ()*/
>> if(res < 0)
>> {
>> cerr << "Can't create Java VM" << endl;
>> exit(1);
>> }
>> cout << "JNI_CreateJavaVM() is OK" << endl;
>> jvm->DestroyJavaVM();
>> }
>>
>> g++ -g simple.cpp -L/usr/local/jdk/jre/lib/i386
>> -L/usr/local/jdk/jre/lib/i386/classic
>> -L/usr/local/jdk/jre/lib/i386/native_threads -ljava -ljvm -lpthread
>> -lhpi -o Simple
>> Simple
>>
>> I use java version "1.2"
>> Classic VM (build Linux_JDK_1.2_pre-release-v2, native threads, nojit)
>> on RedHat5.2
>>
>>
>> Thanks a lot,
>> Pierre
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>> with a subject of "unsubscribe". Trouble? Contact
>[EMAIL PROTECTED]
>
>
>____________________________________________________________________
>Get free email and a permanent address at http://www.amexmail.com/?A=1
>
>
>----------------------------------------------------------------------
>To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>with a subject of "unsubscribe". Trouble? Contact
[EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]