Trouble with JNI wrapper functions

C

Colby Nyce

Hi all,

I am trying to call Java methods from C++ code using the JNI wrapper
functions that we have available in the "jmi" library, but I am having
difficulty figuring out how to obtain one of the required input variables.
I need to use any one of the "mljCall<type>Method" functions, such as:

mljCallVoidMethod
mljCallIntMethod
mljCallBooleanMethod
etc

These functions accept at least two parameters. The first is a "jobject",
and the second is a "jmethodID" (any additional arguments are treated as
input parameters to your Java method). I have been able to get an address
to my Java method, but I am not sure how to get an appropriate "jobject" to
use with this function. The code I have boils down to this:

/**************************************************************************/
jclass objectClass = mljFindClass("WebScopeInterfaceToJava");
jmethodID webscopeMethod = mljGetMethod(objectClass, "voidMethod",
"()V");
jobject j_obj = // How do I get this?
mljCallVoidMethod(j_obj,webscopeMethod);
/**************************************************************************/


Where do I get the correct "jobject" from? Is this available from the
global JVM or something? I have looked through a lot of the source code,
but I am finding it to be somewhat cryptic. Please bear with me, I am
completely new to JNI!

Thanks,
Colby
x7888
 
R

Roedy Green

Please bear with me, I am
completely new to JNI!

See http://mindprod.com/jgloss/jni.html

Order a textbook.

Google the names of problematic methods. Looking at other people's
code will give you clues on how to use them.
--
Roedy Green Canadian Mind Products
http://mindprod.com
The modern conservative is engaged in one of man's oldest exercises in moral philosophy; that is,
the search for a superior moral justification for selfishness.
~ John Kenneth Galbraith (born: 1908-10-15 died: 2006-04-29 at age: 97)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top