Search code examples
javajava-native-interface

Checking if a Java object is of an array type in JNI


Say I have a MyClass class in Java, is there a way to check in JNI that a jobject is a MyClass[][]?

My initial idea was to use env->IsInstanceOf(myobj, myArrayClass), but calling env->FindClass("[MyClass") throws a NoClassDefFoundError.


Solution

  • I know this question is old but...

    To find a class of your array, use:

    env->FindClass("[[Lmy/package/MyClass;")