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:
http://java.sun.com/products/jdk/1.2/docs/guide/jni/spec/functions.doc.html#16536
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:
http://www.hotdispatch.com/requester-view-solution?ID=11970505&TASKID=11966964
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


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

 

 

About | Sitemap | Contact