Chapter 4. Java development and job management with Eclipse 67
4.4 Debugging
When developing complex applications, it is usually necessary to perform some
debugging. The following sections explain how to remotely debug the Java
application.
4.4.1 Setting options
If you want to debug your application with Eclipse, make sure that the Java class
file generation options for debugging have been chosen in the Eclipse
Preferences dialog. From the Window menu, click Preferences. The Preferences
dialog shows up, as shown in Figure 4-12.
Figure 4-12 Eclipse Preferences dialog
Under Java Compiler, the first three Classfile Generation options should be
checked. Also verify that the right compiler compliance level is set. We used 5.0
68 Java Stand-alone Applications on z/OS Volume II
in our scenario. Rebuild the project. Now the program contains all necessary
information for debugging.
To enable the JVM on the host for debugging, JVM options have to be set. Open
the JCL in the jcl folder and uncomment the debugging line as shown in
Example 4-4.
Example 4-4 JVM debugging options in the JCL
# Uncomment the following line if you want to debug the application
IJO="$IJO -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000"
-Xdebug and -Xrunjdwp are the JVM options that support remote debugging. The
transport=dt_socket specifies the communication transport mechanism
between the JVM (server) and debugger (client). Don’t forget to set server=y. It is
the option that lets the JVM listen for the debugger on the port specified in the
address option. Otherwise, the JVM tries to connect to a nonexisting server
because the default value of the server option is n. In the above shell script, the
JVM starts as the debugging server that listens on port 8000.
Other options and explanations for -Xrunjdwp can be found in Table 4-1.
Table 4-1 -Xrunjdwp options
Before you can deploy the application for debugging, debug = yes has to be set
in the zos.properties file. This option forces the submit plug-in not to wait for
Option Name and Value Description Default
suspend=y|n Wait on startup? y
transport=<name> Transport spec none
address=<listen/attach Address> transport spec ""
server=y|n Listen for debugger? n
launch=<command line> Run debugger on event none
onthrow=<exception
name>
Debug on throw none
onuncaught=y|n Debug on any uncaught? n
strict=y|n Skip JVMDI bug
workarounds?
n
stdalloc=y |N Use C Runtime
malloc/free?
n

Get Java Stand-alone Applications on z/OS Volume II now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.