0
Exception in thread "main" java.lang.IllegalArgumentException: Attempt to use non-static field with ReferenceType

i trace the code which like below:

  if(!var5.isStatic()) {
            throw new IllegalArgumentException("Attempt to use non-static field with ReferenceType");
        }

and my Class is:

public class App {
private String version;
private int system;}

i know is not static,but i want to get the value of version,but the type of value is com.sun.jdi.ObjectReference,so how could i get the value of version?

paxi
  • 21
  • 1
  • 5
  • `var5.referenceType().getValue(var5.referenceType().fieldByName("version"))` should works – Luca Basso Ricci Apr 24 '17 at 11:31
  • THX for your answer。 it is still not work ,but i find out this can be done by codes:List ors=rt.instances(0l);ors.get(0).getValue(field); – paxi Apr 27 '17 at 07:29

0 Answers0