i'm quite new at jni so please excuse my code if its messy. So i made a function in java called getPid()
to get the pid of a running process. And whenever it finds the pid, it sets the value of this variable:
public int pid
to the pid value. I wanna get this variable's value in c++, and this is what i have right now:
int getPid(JNIEnv* _env, jobject _object) {
jclass myClass = _env->FindClass("com/dark/force/MenuService");
jfieldID jfieldId = _env->GetFieldID(myClass, "pid", "I");
jint i =_env->GetIntField(_object, jfieldId);
return i;
}
And i wanna invoke this in the same c++ file. How can i do that? Any help is appreciated!