jeudi 5 mars 2015

Invoke a method of an Object in the Heap of a jvm



Is it possible to get an Object from the Heap in a JVM and call a method on it.


Lets say I have this:



public class TestObjectOnHeap {
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


And I created a web application that instantiated the class like this



TestObjectOnHeap obj = new TestObjectOnHeap();
obj.setName("created in webapp");


Then I wanted to create a different application (maybe via a javaagent?) that read that value and printed "created in webapp"


Is this possible?




Aucun commentaire:

Enregistrer un commentaire