From C using JNI, I would like to create a Java object that is then assigned to a variable declared in Java. I have been reading a lot about this subject but so far could not reach to any conclusion or code a solution. Basically, what I would like to do is the following:
In Java:
(...)
Object myVar;
c_function(myVar);
System.out.println(myVar);   // print the content of myVar which was created in C
(...)
In C:
#include "jni.h"
(...)
void c_function(jobject my_var)
{
    jclass jcls;
    jcls = env->FindClass("java/lang/Object");
    my_var = env->AllocObject(jcls);
}
(...)
 
    