Hi,

I'm trying to learn the JNI using the Java Tutorial and the JDK docs,
since the books I have don't cover it at all.  Mostly things are ok,
I can call Java from C and vice versa and have passed some arguments
successfully.  However, I did get an error when trying to run one of 
the Tutorial's examples.  I was wondering if this is a bug in the JDK
or if I need to upgrade some library.

The example (Prompt) of how to pass and return arguments
from C routines exits:

weka:native[ 863 ] java Prompt
Type a line: hi there
SIGSEGV   11*  segmentation violation
        stackbase=0xbffff920, stackpointer=0xbffff7bc

Full thread dump:
    "Finalizer thread" (TID:0x40668220, sys_thread_t:0x413d1f28, state:R) prio=1
[etc...]
Return from sysThreadExit(): a zombie is awake!
[etc...I like the undead error message]

A routine where I only pass in a string, not try to return it, works fine.
Apparently it crashes at the
  return (*env)->NewStringUTF(env, buf);
in the example.

I'm running jdk1.1.3 on Debian Linux 1.3.  The example can be found at
http://java.sun.com/docs/books/tutorial/native1.1/implementing/declare.html

thanks,
Mark

Reply via email to