(The following post was contributed by Divesh Goyal and the Java development team) 

Updated 4/14/08 - Added link to a downloadable ZIP file containing the plug-in. 

New tool - Eclipse plug-in for debugging Java ArcObjects code
Programming language(s): Java
Development platforms: ArcGIS Engine, ArcGIS Server

As we approach another developer summit, I am glad to announce the availability of an Eclipse plug-in for ArcGIS Server and ArcGIS Engine Java Developers that will greatly simplify debugging ArcObjects code.

About the plug-in

One of the most invaluable tools that developers have at their disposal is a debugger through which they can step through code one statement at a time and inspect objects in the application. As most of you may already know, java classes in the  ArcObjects API are really only proxies to underlying COM ArcObjects. As a result, examining these proxies in the debugger only reveals their internal details and not the state of the ArcObjects. This makes it difficult to find out information such as the co-ordinates of an Geometry, or the Layers in a MapServer. Consequently, developers have to sprinkle their code with System.out.printlns and analyze traces on the console to get this information. This approach is inconvenient and time consuming.

With this new Eclipse plug-in, Java developers can examine the state of the underlying ArcObjects right in Eclipse IDE's Debug Perspective by enabling the "Show Logical Structure" option on the Expression and Variables window. Here’s an example of a Point object without the “Show Logical Structure” option enabled.

This information fails to provide any valuable insight into the underlying ArcObject and is not helpful in reasoning through a workflow while debugging. Now here’s the logical representation of the same object using the “Show Logical Structure” option enabled.

The logical representation presents more comprehensible information about the underlying ArcObject's state. This state is defined by the no-argument getter methods on it. You might sometimes see exception messages like “Exception Occurred: com.sun.jdi.InvocationException occurred invoking method” in the logical representation. This is normal and happens when some property of the ArcObject is not valid in the current context of the application.

The underlying ArcObjects could be running remotely in a separate process as in the case of ArcGIS Server web applications, or in the same process like in ArcGIS Engine applications. Thus, both Engine and Server developers can take advantage of this plug-in to debug their applications. I am very excited to share this plug-in with you, and look forward to your feedback. Code on!

How to get the plug-in

Follow these steps to download and install the plug-in from the EDN Website:

  1. In the Eclipse workbench, go to Help > Software Updates > Find and Install
  2. Select Search for new features to install, and click Next
  3. Create a New Remote Site for the URL  “http://downloads.esri.com/EDN/java/plugins/eclipse” 
  4. Enable this remote site and click Finish.
  5. Expand the EDN tree in Search Results, and select the ArcGIS Debug feature.
  6. Proceed to install the plug-in, and restart the workbench when prompted.

Added 4/14/08 - If you are unable to access the plug-in from the URL in Step 3 above, we have also made it available as a downloadable ZIP file here.