This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Please, help. It's JNI_CreateJavaVM trouble again

 
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
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic