Debugging Java™ code
You can debug Java™ code running under control of a Notes® client JVM (Java™ Virtual Machine).
Before you begin
- Foreground - Java™ code that runs in the Notes® client interactively, for example, an agent triggered from the Actions menu.
- Background - Java™ code that runs in the Notes® client under control of the task loader, for example, a locally scheduled agent.
- Web preview - Java™ code being previewed in a browser through Domino® Designer, for example, an applet on a form.
Java™ code from a script library runs in the context of the calling code.
About this task
Procedure
- Add
JavaEnableDebug=1
to thenotes.ini
file in the Notes® directory. - Choose Java™ Debugging Preferences" dialog.
. This opens the "
- To enable foreground debugging, select
Client Agents/Applets
and specify a port number to connect the Notes® and debugger computers. - To enable background debugging, check
Locally Scheduled Agents
and specify a port number to connect the Notes® and debugger computers. - To enable Web preview debugging, check
Http Preview
and specify a port number to connect the Notes® and debugger computers.
- To enable foreground debugging, select
- Restart Notes®.
- Set up the element for debugging.
- Open the element in Domino® Designer.
- On the Properties tab, select
Security
then selectCompile Java code with debugging information
. - Open the main class, for example,
JavaAgent.java
. - Add
sleep
commands at the beginning. The duration must be long enough so you can connect with the debugger at runtime. - Set a breakpoint at the line following the
sleep
commands. - Save the element.
- Create a debug configuration.
- Open the main class.
- Click .
- In the "Debug Configurations" dialog, select
Remote Java Application
and create a new configuration. - Name the configuration.
- Specify the project containing the element being debugged.
- Set the host to
localhost
or127.0.0.0
. - Set the port to match the value set in the Notes® client.
- Click Apply and Close.
- Debug the element.
- Start the element in the Notes® client. For example, an agent might be started from the Actions menu.
- In Domino® Designer, open the main class. Ensure that a breakpoint is set.
- Click .
- Select the debug configuration that matches the element you are debugging and click Debug.
The element stops at the breakpoint and you can debug. After starting the element, you must apply the remaining steps while the element is sleeping. - To debug a second element, select the element through the Browse button in "Debug Configurations" and click Apply.