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:
  - Close every office process.
- Search and open the file java.ini (Windows) and javarc (Unix) respectivly.
- 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.
- Invoke your office application.
 
- In NetBeans/Forte for Java, mount the directory, where the source file resides.
- Open the source file in the source editor of NetBeans/Forte for Java.
- 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.
- In the Attach to VM dialog box, choose the debugger type "Default debugger 
    (JPDA)".
- 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.
- Invoke your Java Office component.
- 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