Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » Writing and debugging Java agents in Eclipse
« What's on your Domino wish list
My 100th blog post: my Java StringArray class »

Writing and debugging Java agents in Eclipse

Copy the correct .jar files

To run Java agents Eclipse, you have to copy the Notes.jar and/or NCSO.jar from the Notes/Domino version you are working on to a subdirectory of your Eclipse project. For Notes/Domino 7, You can find NCSO.jar in 'Data\domino\java' and Notes.jar in 'jvm\lib\ext'. You can then add it to your project: properties, Java Build Path, Libraries, Add external JARs.

The two-headed beast

This trick is explained by Bob Balaban. You provide the extra method 'main' to run the agent in Eclipse. The method 'notesMain' kicks in when you copy the agent back in the Notes environment. Here is a sample of how this looks:

package dworks.test;
import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {
        try {
            Session session = getSession();
            AgentContext agentContext = session.getAgentContext();

            // (Your code goes here)

        } catch(Exception e) {
    public static void main() {
        System.out.println("Debug mode in Eclipse");
        // (Your debug code goes here)

Connect to Domino with DIIOP

Java access to the Domino Objects explains how to make a remote session with DIIOP.
Connecting Domino to the Enterprise Using Java is a Redbook whick might also be useful.

First, make sure the DIIOP task is running on the Domino server. To start a remote session is dead easy:

package dworks.test;
import lotus.domino.Database;
import lotus.domino.NotesFactory;
import lotus.domino.Session;

public class Test {

    public static void main(String[] args) {
        try {
            Session s = NotesFactory.createSession("localhost", "username", "password");
            Database db = s.getDatabase(null, "works/wiki.nsf");

            if (db.isOpen())
            else {
                System.out.println("Database does not exist");

        catch(Exception e) {

While working on the agent in Eclipse, you can connect to the Domino objects using DIIOP. Note: I don't use remote debugging here but the debug capacities of Eclipse itself.

Domiclipse Java

Domiclipse Java is a plugin for Eclipse which allows you to replicate your Java agents and script libraries to the Eclipse environment and then replicate changes back to Domino. Apart from the installation of the plugin, you have to make Eclipse aware of your Notes environment.

Star rating



To add a comment, log in or register as new user. It's free and safe.