Forum Stats

  • 3,840,396 Users
  • 2,262,599 Discussions
  • 7,901,263 Comments

Discussions

Access to a field

aecordoba
aecordoba Member Posts: 13
edited May 11, 2011 4:36PM in Java Native Interface (JNI)
Hi there!
I have the following situation:

class A {
String aField;
...
*String getAField(){*
return aField;
}
}

class B{
A bField;
...
*A getBField(){*
return bField;
}
}

class C{
native byte[] nativeMethod(B object);

static {
System.loadLibrary("nativelib");
}

public static void main(String args[]) {
B bObject = new B();
byte[] byteArray = nativeMethod(bObject);
...
}
}

The native method will be:

JNIEXPORT jbyteArray JNICALL Java_C_nativeMethod (JNIEnv * env, jobject jobj, jobject bObject)

But, how can I access to aField (A class field) within this c (or C++) function?

Can somebody help me?

Thank you, in advance.
Tagged:

Answers

This discussion has been closed.