Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7710
| From | "Colby Nyce" <cnyce@mathworks.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Trouble with JNI wrapper functions |
| Date | 2011-09-08 15:10 -0400 |
| Organization | MathWorks |
| Message-ID | <j4b3uf$efj$1@newscl01ah.mathworks.com> (permalink) |
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
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
Trouble with JNI wrapper functions "Colby Nyce" <cnyce@mathworks.com> - 2011-09-08 15:10 -0400 Re: Trouble with JNI wrapper functions Roedy Green <see_website@mindprod.com.invalid> - 2011-09-08 12:35 -0700
csiph-web