title: Can't make call from C++ To Java using JNI
body: <p>I have a little project with cocos2d-x libraries. I'm trying to use C++ to call a Java function but i get a signal 11 exception at line:</p>
  
  <pre><code>// Get Status
  status = jvm-&gt;GetEnv((void **) &amp;env, JNI_VERSION_1_6);
  </code></pre>
  
  <p>But i don't know why this is happening.</p>
  
  <p>In my Java class Getsocial.java exist this function:</p>
  
  <pre>
  private void tweet()
      {
          String score = "123";
          String tweetUrl = "https://twitter.com/intent/tweet?text=Hello ! I have just got " + score + " points in mygame for Android !!!!";
          Uri uri = Uri.parse(tweetUrl);
          startActivity(new Intent(Intent.ACTION_VIEW, uri));
      }
  </pre>
  
  <p>This function launch navigator to post a tweet. Called from Java works fine.</p>
  
  <p>In my C++ InterfaceJNI.h I have:</p>
  
  <pre>
  #ifndef __INTERFACE_JNI_H__
  #define __INTERFACE_JNI_H__
  
  #include "cocos2d.h"
  
  class InterfaceJNI
  {
  public:
      static void postMessageToFB();
      static void postMessageToTweet();
  
  protected:
  
  };
  
  #endif // __INTERFACE_JNI_H__
  </pre>
  
  <p>And in InterfaceJNI.cpp:</p>
  
  <pre>
  #include "InterfaceJNI.h"
  #include "platform/android/jni/JniHelper.h"
  #include  jni.h >
  #include  android/log.h >
  
  using namespace cocos2d;
  
  void InterfaceJNI::postMessageToTweet()
  {
      int status;
      JNIEnv *env;
      JavaVM *jvm;
      jmethodID mid;
      jclass mClass;
      bool isAttached = false;
  
      CCLog("Static postMessageToTweet");
  
      // Get Status
      status = jvm->GetEnv((void **) &env, JNI_VERSION_1_6);
  
      CCLog("Status: %d", status);
  
      if(status AttachCurrentThread(&env, NULL);
          CCLog("Status 2: %d", status);
          if(status GetStaticMethodID(mClass, "tweet", "()V");
      CCLog("mID: %d", mid);
  
      if (mid!=0)
          env->CallStaticVoidMethod(mClass, mid);
              //-----------------------------------------------------------
      CCLog("Finish");
      if(isAttached)
          jvm->DetachCurrentThread();
  
      return;
  }
  </pre>
  
  <p>This interface is called from a part of the code using:</p>
  
  <pre>
  #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
      InterfaceJNI::postMessageToTweet();
  #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
      ObjCCalls::trySendATweet();
  #endif
  </pre>
  
  <p>What is happening to return a null pointer on jvm->GetEnv((void **) &amp;env, JNI_VERSION_1_6); ?</p>