fhucho
fhucho

Reputation: 34550

How to call Java method from C++

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++?

Upvotes: 2

Views: 2308

Answers (2)

Aaron S
Aaron S

Reputation: 5323

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

Upvotes: 0

CB Bailey
CB Bailey

Reputation: 793007

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.

Upvotes: 3

Related Questions