Is there any way to access a Java method/function local variables and local object instances through JNI

  c++, java, java-native-interface, jvm, jvmti
public class some_class
    public static void som_func() {
        var some_object = new SomeObject();
        var ret = 0;
            ret = some_object.DoSomething();
        } while(ret != 1);
        System.out.printf("Return value: %d", ret);

Now in C++ if I call like this way:

auto some_cls = g_env->FindClass("some_class");
auto some_func = g_env->GetStaticMethodID(some_cls, "som_func", "()V");
g_env->CallStaticVoidMethod(some_cls, some_func);

Is there any way to access that
some_object variable var some_object = new SomeObject();
or that ret variable var ret = 0; through JNI or any JVM memory accessing trick?

I want to do something like:

auto some_object_class = g_env->FindClass("SomeObject");
and then some way this 'some_object_class' will be a reference to that local variable 'some_object'

I suppose I am trying to know how to access the JVM’s heap memory? I heard that JVM allocates an object on the heap and a reference to that allocated object is stored on the stack, if that’s the case can I access that stack memory and retrieve the reference? I am confused, I guess I don’t know what I am talking about in the end. Please guide me to the right path.

Source: Windows Questions C++