Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to write a jobject as return value

843829Oct 4 2001 — edited Jul 31 2002
Problem: I need to set (write) about 5-10 values in my c function to return to the calling java method. The values are all primitive types and jstring. The arguments for the JNI function are all passed by value, so they are only input.
To my knowledge I can only use the return value for output.

Is it possible to define a jobject containing all member variables I need, set these variables in the c function and return the jobject to java ? Or even use a jobject as an argument (as that's the only type which is passed by reference) and set it in the C function ?
How can I do that - in the java portion and in the c portion ? I could not find this in the Java docs.
Sample code is appreciated.

Thanks, Bernhard
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2002
Added on Oct 4 2001
3 comments
265 views