I have an object that is calling a JNI function which written in C.

Donald Sedota

This was answered at HotDispatch.com, the following was the solution: How to Access Fields is described here:
For example,

    jclass IDClass = (*env)->FindClass(env, "ID");
    jfieldID usernameID = (*env)->GetFieldID(env, IDClass, "userName", "LName;");
    jobject username = (*env)->GetObjectField(env, IDobj, usernameID);
    jclass NameClass = (*env)->FindClass(env, "Name");
    jfieldID firstnameID = (*env)->GetFieldID(env, NameClass, "firstName, "Ljava/lang/String;");
    //replace myNewFirstName with the new first name
    jstring newFirstName = (*env)->NewStringUTF(env, "myNewFirstName");
    (*env)->SetObjectField(env, username, firstnameID, newFirstName);
You can find this solution at HotDispatch at:
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact