Prev Next

Java JDWP Debugger

Java provides two main debugging technologies: an in-process agent-based system called the Java Virtual Machine Tools Interface (JVMTI) and a socket-based paradigm called the Java Debug Wire Protocol (JDWP). A Java Virtual Machine can name either one of these but not both, and the feature must be configured when the JVM is started.

System Requirements

  1. The Enterprise Architect JDWP debugger will only be able to communicate with a JVM started with the 'JDWP' option. Here is an example of the command line option:
         java -agentlib:jdwp=transport=dt_socket,address=localhost:9000,server=y,suspend=n -cp "c:\java\myapp;%classpath%" demo.myApp "param1" "param2"
  2. The Virtual Machine should not be currently attached to a debugger.
  3. It is not possible for a VM to be debugged by Enterprise Architect and Eclipse at the same time.

Analyzer Script Settings

Field/Button

Action

See also

Debugger

Click on the drop-down arrow and select Java (JDWP).

Run

Click on this radio button to run the debugger when the script is executed.

Default Directory

Not applicable - leave blank.

Application path

Not applicable - leave blank.

Command Line Arguments

Not applicable - leave blank.

Build first

Not applicable - leave blank.

Show console

Not applicable - leave blank.

Show diagnostic messages

Not applicable - leave blank.

Connection

Not applicable - leave blank.

Port

Set the application port forward-assigned to the VM process during start-up, in the Java command-line options.

Java Command Line Options

Host

Set the host computer (defaults to localhost)

If VM is running on a networked computer, enter the network name or url here.

By default debugging will attempt to connect to the port you specify on the local machine.

Source

This is the source equivalent of the classpath setting in Java.

List the root to each source tree; specify at least one root source path. If you specify more than one, separate them with a semi-colon; for example:

     c:\myapp\src;c:\myserver\src

When a breakpoint occurs the debugger searches for the Java source in each of the source trees listed here.

Logging

Enable or disable logging of additional information from the debugger.

Possible values include:

  • true
  • false
  • 1
  • 0
  • yes
  • no

Output

Specify the full name of the local log file to be written. If the folder does not already exist, no log will be created.

The log file typically contains a dump of bytes sent between the debugger and VM.

Platform

Select Java.

Configure Ports for Debugging

The debugger can only debug one VM at a time; it uses a single port for communication with the VM. The port for the application to be debugged is assigned when the VM is created.

Local Debugging

Where both Enterprise Architect and the Java VM are running on the same machine, you can perform local debugging. It is necessary to launch the VM with the JDWP transport enabled - see the documentation on Java Platform Debugger Architecture (JPDA) at Oracle for the command line option specifications. For example:

     java -agentlib:jdwp=transport=dt_socket,address=localhost:9000,server=y,suspend=n -cp "c:\samples\java\myapp;%classpath%" samples.MyApp "param1" "param2"

In this example the values for the Analyzer script would be 'host: localhost' and 'port:9000'.

Remote Debugging

Where Enterprise Architect is running on the local machine and the Java VM is running on a remote machine, you can perform remote debugging. It is necessary to launch the VM with the JDWP transport enabled - see the documentation on JPDA at Oracle for the command line option specifications. Here is an example, where the remote computer has the network name testmachine1:

     java -agentlib:jdwp=transport=dt_socket,address=9000,server=y,suspend=n -cp "c:\samples\java\myapp;%classpath%"  samples.MyApp "param1" "param2"

Note the absence of a host name in the address. This means the VM will listen for a connection from any machine. In this example the values for the Analyzer script would be 'host: testmachine1' and 'port: 9000'.