title: How to create static JNI Environment Pointer?
body: <p>Here I create a class in JAVA in which I have function (callback) which I must call from C file.</p>
  
  <pre><code>class DSMInitializeClassParameter {
  
      /**
       * Callback function for DSM Initialize.
       */
      public void DSMInitializeCallback( ) {
  
          // Write Message To Logs.
          System.out.println( "Dsm Initialize Callback called." );
      }
  }
  </code></pre>
  
  <p>For that I have created native method which must be called.</p>
  
  <pre><code>public class DsmLibraryTest extends Activity {
       // Some code ....
  
       // Create a DSMInitializeClassParameter  class object.
       DSMInitializeClassParameter object = new DSMInitializeClassParameter();
       // Call native method with given object.
       nativeMethod( object );
  
       // Some code ....
  
       // Implementation of native method.
       public native int nativeMethod(DSMInitializeClassParameter classObject);
  }
  </code></pre>
  
  <p>In <strong>C</strong> file I have following:</p>
  
  <pre><code>dsmResult_t dsmInitializeCall( dsmResult_t status, void * pUserData, dsmEvent_t * hEvent ) {
  
      (*env)-&gt;CallVoidMethod(env, classObject, mid);
  }
  
  JNIEXPORT jint JNICALL Java_com_Dsm_Test_DsmLibraryTest_nativeMethod(JNIEnv* env, jobject obj, jobject classObject) {
      // This function loads a locally-defined class. It searches the directories and zip
      // files specified by the CLASSPATH environment variable for the class with the specified name.
      jclass cls = (*env)-&gt;FindClass( env, "com/Dsm/Test/DSMInitializeClassParameter" );
      // Get java Method.
      jmethodID mid = (*env)-&gt;GetMethodID(env, cls, "DSMInitializeCallback", "()V");
      // If no method was found return -1;
      if( mid == NULL ) {
          return -1;
      }
  
      // Call DSM Initialize Callback Function and return value.
      return dsmInitialize( dsmInitializeCall, NULL );
  }
  </code></pre>
  
  <p>how you can see I want to call <code>(*env)-&gt;CallVoidMethod(env, classObject, mid);</code> from <code>dsmInitializeCall</code> function, but how I can call it if I have no <code>env</code>, <code>classObject</code> and <code>mid</code> I try with statics but it not work.</p>