Skip to main content

JNI accessing Integer datatype

1 reply [Last post]
Joined: 2010-01-14


I have a Java method which looks like:

public class Data {
Integer print();

To access this method in C++, I have the following JNI method:

JNIEXPORT void JNICALL Java_GenericPeer_print (JNIEnv *jenv, jclass jcls, jobject data){

jclass peerCls = jenv->GetObjectClass(data);
jmethodID mGetValue = jenv->GetMethodID(peerCls, "print","()Ljava/lang/Integer;");
jobject o =jenv->CallObjectMethod(data, mGetValue);
cout<<"o = "<

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-05-01

Hi h_p,

Sorry I took so long to respond. By now you've probably found help elsewhere.

Anyway, JNI questions should go to . However, please do come back to help out here. I don't use Java; I only try to garden a community out of this forum because I'm a FOSS geek.