This is probably a daft question that reveals a lack of understanding of JNI. I\'m writing a C++ program that encapsulates the Java VM: I\'m calling functions within the VM usin
The jclass
instance is your object on which a method will be invoked; you'll need to look up the getName
method ID on the Class
class, then invoke it on the jclass
instance using CallObjectMethod
to obtain a jstring
result.
So in short yes, you just call the getName
function and look at the jstring
result.
EDIT
(error handling elided)
JNIEnv* env = ...;
// substitute your desired class's specifier for "java/lang/Class"...
jclass cls = env->FindClass("java/lang/Class");
jmethodID mid_getName = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
jstring name = env->CallObjectMethod(cls, mid_getName);