• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNI: How to introspect an inner class

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a C JNI function, I need to construct an instance of an inner class. My problem occurs when I try to get the method ID for the constructor.
The class I want to construct in C is called Wrapper, and it looks like this;
public class Maths {
static { System.loadLibrary("Maths"); }
// Native method
public native void nativeM(Wrapper data );
public class Wrapper {
public Wrapper(){};
// Attributes used by the native method
// go here
}
}
If I call GetMethodID() as follows I get an exception saying "no such method".
jmethodID mid = (*env)->GetMethodID (env,
mathsClass,
"<init>",
"()V");
I suppose it must be something to do with the quiky way that inner classes need to be constructed, but can't find anyhting on the Internet about it.
Six cubic meters of sea water to who ever can help (winner collects)
Thanks,
Guy.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I distinctly remember reading somewhere that this was not in any way supported through JNI -- but I can't remember distinctly where I read it. I'll go digging, see if I can find the reference.
Long story short, though, I'm pretty sure you're barking up the wrong tree.
 
reply
    Bookmark Topic Watch Topic
  • New Topic