Obtener objeto de un objeto con JNI en C
public class Student
{
private People people;
private Result result;
private int amount;
}
Aquí está la muestra de la clase en Java; en C, traté de obtener la "gente" en "Estudiante", pero fracasé. Sin embargo, puedo obtener el tipo int "cantidad" de "Estudiante".
jobject getObjectFromObject(JNIEnv *env, jobject obj, const char * fieldName)
{
jfieldID fid; /* store the field ID */
jobject i;
/* Get a reference to obj's class */
jclass cls = (*env)->GetObjectClass(env, obj);
/* Look for the instance field s in cls */
fid = (*env)->GetFieldID(env, cls, fieldName, "L");
if (fid == NULL)
{
return 0; /* failed to find the field */
}
/* Read the instance field s */
i = (*env)->GetObjectField(env, obj, fid);
return i;
}
Estoy tratando de pasar "gente" como nombre de campo en el método, pero aún así da el siguiente error: "java.lang.NoSuchFieldError: gente"