|
Contents |
||
General Debugging from NetBeans or Forte Attach to a running debugger Using the classic VM Registration hints |
||
General |
||
To debug java components one can use the Java Platform Debugger Architecture (JPDA) which is part of the jdk 1.3. Please read also the respective guide and the jdb documentation which are part of the jdk documentation.
Both, the Java Virtual Machine (VM) and the debugger, such as jdb, need
the PATH environment variable set to the jdk/bin directory.
JPDA requires that the VM is started with some
dedicated options in order to enable a connection with a debugger. When using the hotspot VM,
which is the default with OO, there are two options that have to be put into the java.ini (javarc
on Solaris) file. Those options are:
If you do not want the the VM and hence the OO to block until the debugger connects to the
VM you can add "suspend=n". For example:
To start the debugger enter this command:
Note that the debugger does not require to have the the CLASSPATH environment variable set. It need not to know all the classes and jar files which the debugged program uses. |
||
Debugging from NetBeans or Forte |
||
If you use NetBeans or Forte, you can easily attach to the VM. Choose menu Debug->Attach to open the connect dialog. Then select the JPDA debugger and enter the computer name and port. Before attaching one should select the appropriate source file into the editor and set the breakpoints at will. This requires that the directory containing the source file is mounted. |
||
|
||
Attach to a running debugger |
||
JPDA allows also the VM to attach to the debugger. In the examples above the debugger connects
to the VM instead. When VM attaches to the debugger then the entry in the java.ini file has to
be changed to read
Make sure that the debugger is running when the VM instantiated, otherwise the VM, and hence OO, will crash. NetBeans and Forte currently do not support this kind of debugging. |
||
|
||
Using the classic VM |
||
Using the classic VM with JPDA requires to put two additional entries in the java.ini file. For example
|
||
|
||
Registration hints |
||
When you register a Java service then the regcomp program instantiates several other services to carry out registration. Those services are not only bootstrap services (i.e. regcomp knows how to find an instantiate those services),and hence regcomp needs to be told about those service. This is done by applying a command line argument that specifies a registry which contains the appropriate information. That argument starts with -br. The easiest way is to use the applicat.rdb of an installed office. Change into the program directory and type regcomp -register -br applicat.rdb -r applcat.rdb -c file:///d:/office/program/JavaComponent.jar -l com.sun.star.loader.Java2
When the VM service is instantiated it will use configuration settings to configure the VM.
Make sure that the manifest file contains the entry If the component depends on other jar files or classes then you can either edit the java.ini file and add them to the SystemClasspath entry or you use the option dialog to add them to the user classpath. The user classpath can be found in the security pane. The jar file that contains the component does not need to be put in the java.ini or user classpath. If you have already put debug options (-Xdebug, -Xrunjdwp) in the java.ini file then disable them by putting semicolons at the beginning of the respective lines. |
||
Author:
Jürgen Schmidt (
2001-11-07 12:54 PM
) |
||
|