Search code examples
javajava-native-interface

Find add method of java.util.list via JNI


I am trying to find the "add" method of java.util.list. The method takes the input and return value type as follows:

jmethodID addMethodID = (*env)->GetMethodID(env, listClass, "add", "(Ljava/lang/Object)(Ljava/lang/String)Z;");

return value is NULL. Where am I going wrong? Is the boolean specification of the output wrong or is it the input type? Should I specify my input type? If so, how?


Solution

  • java.util.List.add(Object e) only has one argument... you have two listed (object and string) and a return type. I think you want: (Ljava/lang/Object;)Z;