Java compile error

I am trying to compile the Java Agent in Eclipse … I have read, that every agent in Java under Lotus has to have a LotusMain method, as a starting point of program execution. The problem is, that if I try to compile this code under Eclipse, I receive error, that my class do not have a MAIN method:

import lotus.domino.*;

public class CounterMain extends AgentBase {

public void NotesMain() {



	try {

		Session session = getSession();

		AgentContext agentContext = session.getAgentContext();



		// (Your code goes here)

		System.out.println("Just a dummy text");





	} catch(Exception e) {

		e.printStackTrace();

	}

}

}

How can I compile this code without error? Is there something wrong in my Eclipse settings?

Subject: Java compile error

I think, you can’t compile a Notes Agent this way.A Notes Agent is only runnable inside Lotus Notes, not inside Eclipse and not as java standalone programm.

I think, Eclipse tries to compile it as standalone program, and a java standalone progam needs a public static void main method.

I use IntelliJ IDEA to write my Notes Agents, but don’t compile them there, but copy the source code into the Lotus Designer.

Andreas Hoster

mailto:andreas.hoster@herma.de

Subject: I finally know, where is the problem

Actually, there is not a problem ;o) Yes, it is possible to compile Notes Agents in Eclipse … Even if the Eclipse says, that the main function is missing, the source is compiled successfully!

The biggest advantage for me is, that I can remotelly debug applications with Eclipse. I can see the variables, placing break points atc …

This is something Lotus Notes can not do, or not very good …

Subject: RE: I finally know, where is the problem

The default “entry point” for a Notes agent is the NotesMain() method after an instance of the “base” class has been constructed. The default entry point for a standalone Java program is the main() method with a signature as follows:public static void main(String args) {

// code goes here

}

Your class can definitely extend AgentBase and run without problem in Eclipse (or other IDEs) as a stand-alone.

hth,

dgg

Subject: Did you put the Notes.jar file in the Java build path in the project’s properties?

I create Notes agents in Rational and then import the class to Domino.

I have no problems compiling agent code.

See our tips on using WebSphere Studio to create Domino agents:

Howard