Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Options for debugging Java applications

Things you should consider before getting started debugging Java applications.

Debugging applications isn't usually an important consideration when you're deciding on application architectures or requirements. It's one of those items that becomes critical during development if you haven't planned ahead. With Java, iSeries developers usually have a good choice of debugging options. You can select the one that best fits your debug requirements. Debugging Java applications is a LARGE topic. This tip points out your options and some considerations for getting started.

Your options for debugging depend on the following:

  1. The type of Java application you want to debug
  2. The runtime environment for the Java application
  3. The available IBM tools you have for debugging

Development or deployment debugging requirement?

During the application development cycle I usually choose the VisualAge for Java IDE debugger, which is easy to use and offers complete application control. During deployment testing, I choose either the traditional iSeries command line debugger OR the new IBM Distributed Debugger.

Mapping Java application types to debug options

Welcome to Adobe GoLive 5
Application type VisualAge Distributed
iSeries debugger
Java client application Y Y N
Java server application Y Y Y
Java servlets Y (1) Y Y (2)
Remote Java application N Y N


  1. VisualAge uses the built-in WebSphere Test Environment to run servlets and JSPs in the VisualAge IDE workspace so it can use the integrated debugger.
  2. A WebSphere servlet running on the iSeries can be debugged using the standard iSeries debugger, but it requires finding the WebSphere server job and running STRSRVJOB from a command line to attach to the running WebSphere job before selecting the thread and application to debug.
  3. Debugging ANY Java application usually requires having the correct Java version referenced for execution and the correct classpath set for all referenced classes, jars and zip files.
  4. Check the Java version your set up to run with:
    java -- version
    The displayed version number shows which Java runtime environment is loaded if there are multiple setup on your system.

Handling optimized Java classes

Debugging Java applications is different than with other types of applications. Java applications are USUALLY more effectively debugged when the Java application is composed of non-optimized class files. For iSeries, you have the option of using the Java transformer to optimize your Java classes which removes most debug information. You can choose to recompile the classes and specify a lower optimization level (00 or 10). For WebSphere Application Server, you choose the debug level for Java classes that are compiled (e.g., JSPs) by WebSphere at the application server level. You can set the debug level as an option during configuration on a specific application server instance.

iSeries standard debug support

This debugger is invoked from the 5250 command line. It allows setting breakpoints, stepping through an application and inspecting values in an application. It can be used to debug WebSphere classes and can use the STRSRVJOB capability from another job.

The iSeries debugger doesn't need to be installed, since it is a part of the platform for a given OS/400 version.

IBM VisualAge for Java integrated debugger

This debugger adds support for changing code dynamically and visually tracing JSP source execution. It is great during development.

The VisualAge debugger is automatically included with VisualAge in the IDE and doesn't require any setup (nice).

IBM Distributed Debugger

With the distributed debugger you also have the option to do the following:

  1. Load the application from the debugger to start
  2. Attach it to a running application on the local or remote system

To attach to an application on another system, a debug daemon has to be running on the server.

Configuring the debugger is NOT a simple task for a new developer. Don't get too frustrated.

The IBM Distributed Debugger is now included with all new releases of IBM Java development tools. It is an optional component that you have to separately install and configure.

What debug features do you need?

The features available depend on the debug tool you use. All the debuggers support step execution of Java code, setting variable watches to see values of variables. The Distributed Debugger also has built-in tracing support with graphical output that can be helpful.

The VisualAge debugger is integrated with the editor so you can change your code DURING debug and have the changes saved. That's a very productive feature during development.

The VisualAge debugger offers a JSP execution monitor that shows your JSP source running side by side with the generated Java servlet code. It's hard to debug generated WebShere servlets when the source is somewhat cryptic. This makes it easy to debug your JSPs.

Debugger recommendations

Which is the easiest environment to debug with?
In my opinion, hands down it is the VisualAge for Java integrated debugger. It even works for servlets and JSPs when you run them in the WebSphere Test Environment.

Where possible, use the VisualAge debugger for development with VisualAge, WebSphere Studio or other IDEs. (You can import your Java code into VisualAge.)

Which is the best to debugger for applications running on the iSeries?
It depends on your skill sets. If you're an iSeries developer, running the existing iSeries debugger on Java classes makes sense. It's not too hard to do. If you're a Java developer with no real iSeries skills, try the Distributed Debugger. You may need some help with iSeries configuration parameters, but it should be easier to get started here.

What's the future of debugging Java applications?
For IBM, the Distributed Debugger will probably be the tool of choice. VisualAge will evolve into the new WebSphere Studio Application Developer over time, and its debugger will be changed in the new tool. The iSeries debugger is limited to the iSeries and can't work with remote applications such as the Distributed Debugger. Again, for developers new to the iSeries, the Distributed Debugger is probably a better investment. For experienced iSeries developers, the existing debug tool should be faster to use even though it is "green screen."

About the author: Jim is president of ebt-now.com, an IBM and Lotus business partner focused on delivering e-business application solutions for iSeries 400 customers. Jim writes, consults, teaches, designs and develops iSeries Web applications using Java, WebSphere, DB2, Lotus Domino and the WebSphere Development Tools for the iSeries.


Dig Deeper on Web Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.