Checking values ββof a Java class instance variable in Eclipse
In my application, I have a class with multiple member variables and methods. Calling a method with bad parameters raises an AssertionError. I have configured a debugger to stop uncaught exceptions.
The problem is that when switching to the debug perspective, I can only see the instance of the class (on which the function was called) and two parameters. I cannot expand an instance of a class to see the values ββof its member variables. There is a space on the left side of the instance, so I am assuming there should be an arrow there, so you can expand it the same way as in the outline.
Is there a configuration or something I have to enable for this? Or am I misunderstanding the variables window?
If it matters, it's Eclipse 3.2.2 on Ubuntu Linux.
[Update] I downloaded the new version from http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-java-galileo-linux-gtk.tar .gz
"Eclipse" is now reported by "Build id: 20090619-0625".
TestCase:
class Foo {
private int bar;
Foo() {
bar = 1;
}
public void set(int newbar) {
assert (newbar<0);
bar = newbar;
}
}
class Test {
public static void main (String[] args){
Foo f = new Foo();
f.set(5);
}
}
Obviously this code is throwing a claim exception. But the only change is the icon for "this", which has changed from a green circle to a blue triangle in the new version. Still can't find a way to extend it. Here I can see "this" for the Foo instance, as well as "newbar" and its value, to clarify what I want to do is expand "this" and see its current value for "bar".
source to share
After some discussion in, #eclipse
we discovered that the VM issue was the issue. I ran:
/usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/bin/java
Changing it to:
/usr/lib/jvm/java-6-openjdk/bin/java
and issue a flag -ea
as an argument to the VM, let me extend the class instance by checking the value bar
. The problem has been resolved.
source to share
No no. Typically, the first line in the debug view should be "this", which represents the instance you are currently working on. It should have a "+" which you click to expand the list of instance variables.
If that doesn't work, you might be on the wrong stack (you can select it in the stack trace list), or Eclipse cannot resolve the location of your source code, or something else is wrong.
Try to create a small test file where this is reproduced and post it. Then we'll see ...
BTW: Eclise 3.2.2 is pretty old. Consider upgrading to 3.5 to see if the issue persists. You can install multiple versions of Eclipse side by side (just unzip to a directory) so you don't have to hide your existing installation.
source to share