File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes JNI: How to introspect an inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JNI: How to introspect an inner class" Watch "JNI: How to introspect an inner class" New topic

JNI: How to introspect an inner class

Guy Roberts

Joined: Jun 18, 2002
Posts: 1
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,
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)
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

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.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link:
subject: JNI: How to introspect an inner class
It's not a secret anymore!