Debugging java调试接口:获取ObjectReference的值

Debugging java调试接口:获取ObjectReference的值,debugging,jdi,Debugging,Jdi,我跟踪的代码如下所示: Exception in thread "main" java.lang.IllegalArgumentException: Attempt to use non-static field with ReferenceType 我的班级是: if(!var5.isStatic()) { throw new IllegalArgumentException("Attempt to use non-static field with Refere

我跟踪的代码如下所示:

Exception in thread "main" java.lang.IllegalArgumentException: Attempt to use non-static field with ReferenceType
我的班级是:

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

我知道不是静态的,但是我想得到版本的值,但是值的类型是com.sun.jdi.ObjectReference,那么我怎样才能得到版本的值呢?

var5.referenceType().getValue(var5.referenceType().fieldByName(“version”)
应该可以工作到你的答案。它仍然不工作,但我发现这可以通过代码来实现:List or=rt.instances(0l);ors.get(0).getValue(字段);
public class App {
private String version;
private int system;}