title: Passing an object in JNI always returns NULL
body: <p>I am using JNI to pass an object from C++ to Java. But am stuck up somewhere in the code where the 
  "GetMethodID"  always returning NULL and getting crashed! The below is the header file I used and the cpp code followed. </p>
  
  <blockquote>
    <p>My intention is to return an object from the JNI, Where I always get
    "emu_response_constructor Null" in the below cpp code.</p>
  </blockquote>
  
  <pre><code>/* DO NOT EDIT THIS FILE - it is machine generated */
  #include &lt;jni.h&gt;
  /* Header for class com_em_Grabber */
  
  #ifndef _Included_com_em_Grabber
  #define _Included_com_em_Grabber
  #ifdef __cplusplus
  extern "C" {
  #endif
  /*
   * Class:     com_em_Grabber
   * Method:    getProcessedImage
   * Signature: (II[B)Lcom/em/Response;
   */
  JNIEXPORT jobject JNICALL Java_com_em_Grabber_getProcessedImage
    (JNIEnv *, jobject, jint, jint, jbyteArray);
  
  #ifdef __cplusplus
  }
  #endif
  #endif
  </code></pre>
  
  <p>The below is the cpp file I used. Where the object is getting passed to Java.</p>
  
  <pre><code>JNIEXPORT jobject JNICALL Java_com_em_Grabber_getProcessedImage
    ( JNIEnv *env, jobject obj, jint jRows, jint jCols,jbyteArray jByteArray ){
  
           jclass emu_response = env-&gt;FindClass("com/em/Response");
  
           if (emu_response == NULL) {
               cout &lt;&lt; "emu_response Null" &lt;&lt; endl;
          }
  
           jmethodID emu_response_constructor = env -&gt; GetMethodID(emu_response, "&lt;init&gt;", "(II[B)Lcom/em/Response;");
           if (NULL == emu_response_constructor ) {
  
               cout &lt;&lt; "emu_response_constructor Null" &lt;&lt; endl;
  
           }
     int number = 90;
     jobject jEmuResponse = env-&gt;NewObject ( emu_response,emu_response_constructor, jByteArray, number );
  
   return jEmuResponse;
  
  }
  </code></pre>
  
  <p>The below is my java class:</p>
  
  <pre><code>public class Response {
  
  
      private int age;
      private byte[] result = null;
  
  
      public Response()
      {
  
      }
      public Response(byte[] result,int age) {
      this.age = age;
      this.result = result;
      }
  
      public int getAge() {
      return age;
      }
      public void setAge(int age) {
      this.age = age;
      }
      public byte[] getResult() {
      return result;
      }
      public void setResult(byte[] result) {
      this.result = result;
      }
  </code></pre>