Take the 2-minute tour ×

I'm currently debugging classes from a war file that's circa 100 meg, running on Tomcat under Windows 7 and started using "catalina jpda start", and then the project is hooked into the Eclipse debugger.

I've gotten to a point where the class I'm debugging has fully initialized and the variables view in debug perspective looks something like:

:> this
:> referenceIds
:> arr$
:> id

Where :> is supposed to resemble the white right facing triangle that indicates the object can be expanded.

I need to share the 'this' object reference details with another developer off site, and he needs to know the full contents to be able to help me. But a) there is no expand all option (I spent 90 minutes clicking those expansion triangles and was still nowhere near finished, it was like some form of recursion hell clickathon) and b) Even if I right click the above and click 'copy variables', it doesn't give me the expanded information, i.e. clicking 'copy variables' on 'this' gives me the hugely non informative:

REDACTEDProductsDataBuilder  (id=38)    
referenceIds    String[5]  (id=105) 
arr$    String[5]  (id=105) 
len$    5   
i$  3   
id  "4:REDACTEDUpsell" (id=117) 

I've looked around for information on an easier way to do this and come up with nothing. I'm very new at using the eclipse debugger so forgive me if there is an obvious answer to this, surely there is an easier way than spending a day clicking on the expansion triangles? If there isn't, do I have an alternative?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

There doesn't seem to be a simple way to do this as it would be hard for Eclipse to choose a proper representation for the entire object graph to put on your system clipboard.

I would suggest that to help your debugging, the vital fields of the class in question are included in it's toString() representation.

Alternatively you can look into taking a heap dump of the application, and sending this to the remote developer. The heap dump is a binary representation of the entire memory heap of the app, and there are plenty of tools that can be used to examine one such as Eclipse Memory Analyzer or jhat.

share|improve this answer
We ended up using join.me in the end, very handy for this kind of situation. Will look into heap dumping, thanks. –  Saf Sep 6 '12 at 11:49
add comment

You can implement a method toJSON() in the interesting class, so when you are debugging you can:

  1. right click on the interesting variable (the interesting instance of the interesting class) d
  2. Click on "New Detail Formatter"
  3. add the following snippet of code: this.toJSON()

Then the variable representation will change.

Usually i implement toJSON() method with Jackson lib to print all object graph, like below:

String res="";
ObjectMapper objectMapper=new ObjectMapper();   
return res;
share|improve this answer
add comment

Your Answer


