CallStaticStringMethod JNI (version 0.11.0)

CallStaticStringMethod JNI (version 0.11.0)
0.0 0


Hi all,

I got a problem in calling Java method in C++ using JNI. The method returns const char* which in Java is String.
For now I use methodInfo.env~~>CallStaticCharMethod;
But, the return result is not as expected .
if I change into CallStaticStringMethod, it returns error when compilation.
Can anyone show the correct form of method that returns const char* or String ?
Below is my JNI code, hope someone can notice the mistake and make a correction to it.
Thanks a lot guys.
const char* getNameJNI{
JniMethodInfo methodInfo;
jstring ret;
if Ljava/lang/String;")){
return ret;
ret = methodInfo.env~~>CallStaticCharMethod(methodInfo.classID, methodInfo.methodID);
return (const char*)ret;


if you still have this problem, you can try to use this.

jboolean isCopy;
const char * out = methodInfo.env->GetStringUTFChars(ret, &isCopy);
return out;