title: JNI GetMethodID not working for constructor of inner class
body: <p>I have a class with a private subclass. I want to create an instance of that subclasss in a JNI wrapper and return it. I've googled and tried to make it work but with no success (methodID is null). Any suggestions?</p>
  
  <pre><code>JNIEXPORT jobject JNICALL Java_some_Class_some_Jni_Method(JNIEnv *env, jobject this) {
          jclass cls = (*env)-&gt;FindClass(env, "someClass$someSubclass");
          if (cls == NULL)
              printf("jclass error.");
  
          jmethodID methodID = (*env)-&gt;GetMethodID(env, cls, "&lt;init&gt;", "()V"); // -&gt; problem!
          if (methodID == NULL)
              printf("jmethodID error.");
  
          jobject obj = (*env)-&gt;NewObject(env, cls, methodID);
          if (obj == NULL)
              printf("jobject error.");
  
          return obj;
  }
  </code></pre>
  
  <p>EDIT1: adding class definition:</p>
  
  <pre><code>public class someClass 
  { 
      private class someSubclass {    
  
          public someSubclass() {
          }
      ...
      }
  ...
  }
  </code></pre>
  
  <p>EDIT2: Ok I figured out you need parent class in the GetMethodID signature, so in my example: <code>jmethodID methodID = (*env)-&gt;GetMethodID(env, cls, "&lt;init&gt;", "(LsomeClass;)V");</code> </p>
  
  <p>But now I get EXCEPTION_ACCESS_VIOLATION with NewObject function.</p>
  
  <p>EDIT3: I also needed to add calling class object/pointer to the NewObject function: <code>jobject obj = (*env)-&gt;NewObject(env, cls, methodID, this);</code></p>
  
  <p>Constructor of nested class is now called properly.</p>