Debug Java classes loaded through a custom class loader

The easiest way to debug Java™ programs that run on your iSeries™ server is to use the IBM® iSeries System Debugger. The IBM iSeries System Debugger provides a graphical user interface that enables you to more easily use the debugging capabilities of your iSeries server.

For more information about using the iSeries System Debugger to debug and test Java programs that run on your iSeries server, see IBM iSeries System Debugger.

To use the interactive display of your server to debug a class loaded through a custom class loader, complete the following steps:

  1. Set the DEBUGSOURCEPATH environment variable to the directory containing the source code, or in the case of a package-qualified class, the starting directory of the package names.

    For example, if the custom class loader loads classes located under the directory /MYDIR, perform the following:

         ADDENVVAR ENVVAR(DEBUGSOURCEPATH) VALUE('/MYDIR')
  2. Add the class to the debug view from the Display Module Source screen.

    If the class has already been loaded into the Java virtual machine (JVM), just add the *CLASS as usual and display the source code to debug.

    For example, to view the source for pkg1/test14.class, enter the following:

         Opt     Program/module     Library        Type
         1       pkg1.test14_       *LIBL          *CLASS

    If the class has not been loaded into the JVM, perform the same steps to add the *CLASS as previously indicated. The Java class file not available message then displays. At this point, you may resume program processing. The JVM automatically stops when any method of the class matching the given name is entered. The source code for the class is displayed and can be debugged.