I'm having some trouble returning a C struct to Java using JNI. Currently I'm trying to use the javolution Struct library, though the documentation seems to be lacking. I have a small struct now, but will eventually have a struct which contains pointers to other structs, char arrays, etc.
I can't critique the whole program, as I've never used this "javalution struct library" of which you speak, but I can tell you one bad, bad thing about your native code: the argument to NewDirectByteBuffer is supposed to be a pointer to a block of memory that will be staying put; but you're passing the address of a struct on the stack, which will turn into garbage as soon as the native function returns. You need to dynamically allocate (malloc, or new) your struct, or allocate it from a static array of structs, or something -- but you can't return stack-based objects from your JNI functions any more than you can return them within normal C(++) code.