Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging in Eclipse (Java); can't hover over a variable when breaking to view the value

Tags:

java

eclipse

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

From what I can tell, debugging in Eclipse is really bad. I don't know if I'm 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 I'm breaking, but that's not optimal.

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

Edit

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

like image 639
Ted Avatar asked Jan 08 '10 17:01

Ted


2 Answers

Go to Preferences-> Java-> Editor-> Hovers and tick the box 'Variable Values'. If you want Hover to happen automatically then leave the Key Modifier section blank.

like image 159
Roger Thomas Avatar answered Oct 20 '22 04:10

Roger Thomas


There seem to be bugs in Eclipse related to this:

  • https://bugs.eclipse.org/bugs/show_bug.cgi?id=317045
  • https://bugs.eclipse.org/bugs/show_bug.cgi?id=330061
  • https://bugs.eclipse.org/bugs/show_bug.cgi?id=286237

So, yes it is supposed to work, but it doesn't always. I'm having this issues on some classes. It seems to be consistent which classes work and which don't, probably related to what jar the class is coming from etc, but I have no real clue as to what causes it. Would love to see some reproduction scenario.

like image 4
Stijn de Witt Avatar answered Oct 20 '22 04:10

Stijn de Witt