IntPtr classRef = JNIEnv.FindClass("com/example/MyClass"); IntPtr fieldRef = JNIEnv.GetFieldID(classRef, "myLongField", "J"); IntPtr objRef = JNIEnv.AllocObject(classRef); long value = JNIEnv.CallNonvirtualLongMethod(objRef, classRef, fieldRef);
IntPtr classRef = JNIEnv.FindClass("com/example/MyClass"); IntPtr methodRef = JNIEnv.GetMethodID(classRef, "myLongMethod", "()J"); IntPtr objRef = JNIEnv.AllocObject(classRef); long value = JNIEnv.CallNonvirtualLongMethod(objRef, classRef, methodRef);Package/Library: The JNIEnv class is part of the Java Native Interface (JNI) library, which is included in the Java Development Kit (JDK) and Java Runtime Environment (JRE).