| Author |
Please, help. It's JNI_CreateJavaVM trouble again
|
Andrey Safonov
Greenhorn
Joined: Feb 19, 2003
Posts: 3
|
|
I don't know what to do. I have jdk1.4. When I try to compile test.c I've got this: test.o(.text+0x19): undefined reference to `JNI_GetDefaultJavaVMInitArgs' test.o(.text+0x5a): undefined reference to `JNI_CreateJavaVM' I've specified all header files but don't know what else gcc wants p.s.: -ljava -ljvm couldn't be found in OS. What wrong ?
|
 |
Vijayakumar Arya
Ranch Hand
Joined: Jan 27, 2003
Posts: 76
|
|
Hi Andrey, I am not sure whether this is correct. The jni.h file can be located in the <JAVA_HOME>/include directory, have you included this path in your build file. Probably the compiler is not able to locate this include file. But I guess that if the compiler cannot locate an include file, the message will be something else. This is just a guess. Hope this helps
|
Thanks,<p>Vijay<p>The Hand that gives, Gathers.
|
 |
Andrey Safonov
Greenhorn
Joined: Feb 19, 2003
Posts: 3
|
|
Thanks for answer! But the_trouble is somewere else : gcc -I/usr/local/jdk/include -I/usr/local/j2sdk1.4.0/include/linux -L/usr/local/jdk/jre/lib test.c test.c: In function `main': test.c:34: warning: passing arg 2 of `JNI_CreateJavaVM' from incompatible pointer type /tmp/ccALNCFh.o: In function `main': /tmp/ccALNCFh.o(.text+0x19): undefined reference to `JNI_GetDefaultJavaVMInitArgs' /tmp/ccALNCFh.o(.text+0x5a): undefined reference to `JNI_CreateJavaVM' p.s.: jni.h resides in .../jdk/include. [ February 20, 2003: Message edited by: Andrey Safonov ]
|
 |
Vijayakumar Arya
Ranch Hand
Joined: Jan 27, 2003
Posts: 76
|
|
Hi Andrey, I checked at the GCC site and found a same problem and it has been resolved. Have a look at this page: http://gcc.gnu.org/ml/gcc-help/2000-09/msg00144.html
Taken from that answer: Note that if your X libs are not in /usr/X11R6/lib, you will need to change the -L options.
cccc I feel the linker is not able to resolve the function, I mean it is not able to locate. Hope this helps
|
 |
 |
|
|
subject: Please, help. It's JNI_CreateJavaVM trouble again
|
|
|