Debugging Java Components

If you use NetBeans or Forte for Java, you can easily attach to the Java Virtual Machine. Before attaching you should open the appropriate source file into the source editor of NetBeans/Forte for Java and set the breakpoints at will. This requires that the directory containing the source file is mounted. Then you Choose menu Debug->Attach to open the connect dialog. Then select the Java Platform Debugger Architecture (JPDA) and thereafter the connector "SocketAttach (Attaches by socket to other VMs)". Finally, you must enter the computer name and port.

Attaching the debugger to a running office process:

  1. Close every office process.
  2. Search and open the file java.ini (Windows) and javarc (Unix) respectivly.
  3. Customize this file by adding the following lines:
    Java=1
    JavaScript=1
    Applets=1
    -Xdebug
    -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
    The last line effects that the VM listens to port 8000 for a debugger. The VM and hence the office do not block until the debugger connects to the VM.
  4. Invoke your office application.
  5. In NetBeans/Forte for Java, mount the directory, where the source file resides.
  6. Open the source file in the source editor of NetBeans/Forte for Java.
  7. The Attach to VM dialog box enables you to connect the debugger to the office application running on another virtual machine. You open this dialog box by choosing Debug Attach from the main window.
  8. In the Attach to VM dialog box, choose the debugger type "Default debugger (JPDA)".
  9. Then, you must choose the Socket Attach connector. In this context, you must supply the host name of the computer that the Java office application runs on and the number of the port on which the debugged JVM is listening.
  10. Invoke your Java Office component.
  11. Once the debugger connects to the running virtual machine, you will see threads as if you were debugging locally. If you set a breakpoint in the source code, the Source Editor opens with the breakpoint line highlighted in red.

You can find more information on Debugging Java Components

 


Legal Notices