title: JNI return Signal 7 function trying to call to Java from C++
body: <p>I want to make a call from C++ to Java. I try to call a function which retunt a bool value, without parameters.</p>
  
  <p>This is my C++ Code</p>
  
  <pre><code>/**
   * Check if Internet Connection is ONLINE
   */
  bool InterfaceJNI::isInternetConnected()
  {
      JavaVM* jvm = JniHelper::getJavaVM();
      int status;
      JNIEnv *env;
      jmethodID mid;
  
      bool isAttached = false;
      // jboolean o bool?
      bool returnValue = false;
  
      CCLog("Static isInternetConnected");
  
      // Get Status
      status = jvm-&gt;GetEnv((void **) &amp;env, JNI_VERSION_1_6);
  
      if(status &lt; 0)
      {
          //LOGE("callback_handler: failed to get JNI environment, " // "assuming native thread");
          status = jvm-&gt;AttachCurrentThread(&amp;env, NULL);
          CCLog("isInternetConnected Status 2: %d", status);
          if(status &lt; 0)
          {
              // LOGE("callback_handler: failed to attach " // "current thread");
              return false;
          }
          isAttached = true;
          CCLog("isInternetConnected Status isAttached: %d", isAttached);
      }
  
  
      CCLog("isInternetConnected Status: %d", status);
  
      jclass mClass = env-&gt;FindClass("org/example/SocialNetwork/InternetConnection");
  
      // Get Static bool isInternetConnection()
      mid = env-&gt;GetStaticMethodID(mClass, "isInternetConnection", "()Z");
      if (mid == 0)
      {
          CCLog("isInternetConnected FAIL GET METHOD STATIC");
          return false;
      }
      // Call Static bool isInternetConnection()
      returnValue = env-&gt;CallStaticBooleanMethod(mClass, mid);
      CCLog("isInternetConnected Done ");
  
              //-----------------------------------------------------------
      CCLog("Finish");
      if(isAttached)
          jvm-&gt;DetachCurrentThread();
  
      // Change for return value
      return returnValue;
  }
  </code></pre>
  
  <p>And my Java code:</p>
  
  <pre><code>public class InternetConnection 
  {
      /**
       * Check if is working your hello world from C++
       */
      public static void helloWorld()
      {
          Log.v("InternetConnection", "HELLO WORLD");
      }
      /**
       * Check Internet Connection
       * @return true is Online
       */
      public static Boolean isInternetConnection()
      {
          Log.v("InternetConnection", "isInternetConnection Start");
  
          Context ctx = CCSocialNetwork.getAppContext();
          ConnectivityManager conMgr =  (ConnectivityManager)ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo i = conMgr.getActiveNetworkInfo();
  
          if (i == null)
          {
              Log.v("InternetConnection", "isInternetConnection NULL :S");
              return false;
          }
  
          if (!i.isConnected())
          {
              Log.v("InternetConnection", "isInternetConnection is not connected");
              return false;
          }
  
          if (!i.isAvailable())
          {
              Log.v("InternetConnection", "isInternetConnection is not available");
              return false;
          }
          Log.v("InternetConnection", "isInternetConnection DONE!");
          return true;
      }
  }
  </code></pre>
  
  <p>But I get:</p>
  
  <pre><code> Fatal signal 7 (SIGBUS) at 0x00000000 (code=128)
  </code></pre>
  
  <p>And I have If I can get a return value correctly, I neither would be able to send parameters.</p>