I just solve this: two steps: first convert the char * to jbyteArray, then call the java String contructor to create the jstring.
strClass = global_env->FindClass("java/lang/String"); ctorID = global_env->GetMethodID(strClass, "<init>", "([BLjava/lang/String;)V"); encoding = global_env->NewStringUTF("GBK"); jbyteArray bytes = global_env->NewByteArray(strlen(chm_pcText)); global_env->SetByteArrayRegion(bytes, 0, strlen(chm_pcText), (jbyte*)chm_pcText); jstring str = (jstring)global_env->NewObject(strClass, ctorID, bytes, encoding);
David guo
source share