• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Please, help. It's JNI_CreateJavaVM trouble again  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Andrey Safonov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!