Examples: LastRun property (Session - Java)

This agent prints the date and time that the agent last ran.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = 
          session.getAgentContext();
      // (Your code goes here) 
      DateTime date = agentContext.getLastRun();
      if (date.getDateOnly().equals(""))
        System.out.println("Agent was not run before");
      else
        System.out.println
        ("Agent was last run on " + date.getDateOnly() +
        " at " + date.getTimeOnly());
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}