tags:

views:

97

answers:

3

Hey, Im using Eclipse to code Java (for Android) and Im trying to debug the code as I normally do (i normally do C# though).

From what I can tell, debugging in Eclipse is really REALLY bad. I dont know if Im doing something wrong, but it seems to be just awful.

This is the code that is being run, I get some sort of exception and I want to see what the Exception is, by breaking in the "catch"-clause and viewing the variable "e":

try
{
    ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService( Context.CONNECTIVITY_SERVICE );
    NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
    NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    NetworkInfo.State state = mobNetInfo.getState();
}
catch(Exception e)
{
    Log.v("MyAp", e.toString()); // I break on this line, and want to see what e is
}

the problem is that I cannot see "e" by holding my mouse over it (as I can in my beloved Visual Studio).

Now, I know that I can bring up the tab "Variables" which lists all variables accessible from when Im breaking, but thats sort of sucky.

Just so I know - Eclipse has no way of "hovering" over the variable you are interested in, as in Visual Studio?


EDIT 1: Thanks for the answers. However, still have the same problem =(

A: 

You can also highlight the variable, right click, and choose to watch it. Then it shows up on the watch tab. You can also set automatic break points that trigger on the exception being thrown rather than at a particular line of code. There is not 'hover' option to view the variable as in Visual Studio in recent versions of Eclipse.

Jeremy Raymond
hovering over the variable will show the content while halted on a breakpoint
roe
I stand corrected - was using an older version of Eclipse. It does indeed have the hover.
Jeremy Raymond
Weird, I will have to investigate that.
Ted
+1  A: 

This might seem a bit strange, but do you know that the code window has focus? I have observed that sometimes the appearance of the tooltip depends on whether a view has focus or not (which I guess is an SWT bug).

r_
Yes, code window has focus, and I am in "Debug Perspective" (i can Step...)
Ted
+2  A: 

As far as I can tell, you have to be in Debug view in order to hover over objects and see their properties. At least that's how my copy of Eclipse 3.4 works.

Of course, you also need to be in Debug view to have the Step Into, Step Over, Continues, etc... buttons...

R. Bemrose
Debug view means what? I am indeed running the code "in debug"... What do you mean with "debug view"?
Ted
I am in "Debug Perspective" if that is what you mean =)
Ted
Yes, I meant Debug Perspective. I can hover over objects when I'm in this view... although I did use a built in class to test it; `List<String>`... actually `ArrayList<String>`, but I wanted to test to make sure it worked if I declared the variable by its interface.
R. Bemrose
Ok, thx. I cannot hover and see values for some strange reason... hmm
Ted