title: JNI - how to fill a String passed from C++ to Java
body: <p>I need to send empty string from c++ to java and the java function should fill this string so the c++ could use it.</p>
  
  <p>I dont want the Java code to return a value. I want it to fill a received String.</p>
  
  <p>I thought using StringBuilder and this is how my java function looks like:</p>
  
  <pre><code>private static void setValue(StringBuilder param) {
  param.append(value);
  }
  </code></pre>
  
  <p>This is how my C++ code looks like:</p>
  
  <pre><code>jclass class = env-&gt;FindClass("class");
  jmethodID method = env-&gt;GetStaticMethodID(class, "fillValue", "
  (Ljava/lang/StringBuilder;)V");
  </code></pre>
  
  <p>What should i send to the function so it would work?
  I tried sending jstring but it doesnt work.</p>
  
  <p><strong>UPDATE:</strong>
  Tried the following code in c++ side but it didnt work:</p>
  
  <pre><code>char* str;
  jstring string = env-&gt;NewStringUTF( str );
  
  env-&gt;CallStaticObjectMethod(class,method, string);
  const char* test = env-&gt;GetStringUTFChars(string, 0);
  </code></pre>