Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7710
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!news.mathworks.com!not-for-mail |
|---|---|
| From | "Colby Nyce" <cnyce@mathworks.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Trouble with JNI wrapper functions |
| Date | Thu, 8 Sep 2011 15:10:06 -0400 |
| Organization | MathWorks |
| Lines | 39 |
| Message-ID | <j4b3uf$efj$1@newscl01ah.mathworks.com> (permalink) |
| Reply-To | "Colby Nyce" <cnyce@mathworks.com> |
| NNTP-Posting-Host | ah-cnyce.dhcp.mathworks.com |
| Mime-Version | 1.0 |
| Content-Type | text/plain; format=flowed; charset="iso-8859-1"; reply-type=original |
| Content-Transfer-Encoding | 7bit |
| X-Trace | newscl01ah.mathworks.com 1315509007 14835 144.212.115.36 (8 Sep 2011 19:10:07 GMT) |
| X-Complaints-To | news@mathworks.com |
| NNTP-Posting-Date | Thu, 8 Sep 2011 19:10:07 +0000 (UTC) |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Importance | Normal |
| X-Newsreader | Microsoft Windows Live Mail 14.0.8089.726 |
| X-MimeOLE | Produced By Microsoft MimeOLE V14.0.8089.726 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7710 |
Show key headers only | View raw
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