How to find a class instance in a running JVM
<p>I am trying to figure out a way to find a class instance inside a working JVM.  The JVM is embedded into another process and an object is created by this process.  The same process executes my Java code.  I do not have a direct access to the Java object reference in my Java code, but I know the class of that object.  I want to find out if there are objects of this class already instantiated in JVM, and if they are, I want to find them (get say an Object array with references to all the instances of this class).  This mechanism can be either a Java API or an JNI API.</p>

<p>I know it is possible since debuggers let me inspect all instances.  I just cannot seem to find the way.</p>

<p>Thanks</p>

<p>Nikita</p>
