views:

366

answers:

2

Hi, I am using JNI to call my C++ function from Java. One of the C++ function's arguments is jobject thiz (as far as I know, all JNI native functions have this argument). The function takes quite long to complete and I want to report progress back to the jobject thiz Java object, so that I can show the progress to the user. How can I call jobject's methods from C++?

A: 

You need to look at the JNI functions GetMethodID and Call<type>Method*.

The details of the various variants and how to call them are documented the JNI specification.

Charles Bailey
A: 

If you want to integrate C++ and java with a lot less hassle, you should look into Jace http://sourceforge.net/projects/jace/

6pack kid