Home for HMNL Enterprise Computing

Using Java in Domino

Ian Tree  10 May 2006 17:22:18

Why, Where and How to Use Java in Domino Developments

This article discusses the use of Java in Notes/Domino developments.

I am always mildly surprised at how little Java I come across in the wild in Notes/Domino developments. There seems to be a number of different reasons for this situation, including ...
  • Lack of Java experience among Domino developers
  • Lack of Domino experience among Java developers
  • Scepticism on the Web concerning the Domino Java implementation
  • Lack of good design patterns for Java use in Domino applications
  • Bad experiences of some developers when experimenting with Java
  • Reluctance of designers to go for multi-language implementations

All of these factors have served to slow the take-up of Java as a front line development language for Domino applications.

Why Use Java?

There are many good reasons for using Java as a part of an Notes/Domino Application Development project. Among the reasons to use Java are.

1. Because You Have To

For instance if you are building a Servlet to run under Domino then this has to be constructed in Java.

2. To Avoid Pain and Suffering

If, for instance, you needed to interact from a Form in the Notes Client with some other application that offered an http: interface, then it might be possible to either bodge something, put the interaction code in a complex C++ LSX and interface through LotusScript. Both of these solutions could be made to work but are extremely painful options when compared to providing the interface code in Java.

3. Because You Can Save Time

It may be that a significant part of your application could be coded using existing Java packages and therefore you just need to strap them into a Domino/Java framework in order to get most of the functional code developed.

4. Because You Have Java Development Resources Available

Good Java programmers can handle the Domino API relatively easily after doing "Domino Objects 101" and "Using recycle() 102" , they can become productive quite quickly (providing that there is some experienced Domino developer resource available in the development team).

5. You Want to Have Platform Portability

Classes that you have to develop as a part of a development project may also be needed in a WebSphere Application that is also being developed, it makes no sense to do a LotusScript version and a Java version.

Where To Use Java

You can use Java effectively in Notes/Domino developments in the following places.

1. Servlets

Servlets have to be implemented in Java. The Servlet is an under utilised application component in Notes/Domino web-enabled applications. I have seen a number of projects struggle with complexity and performance issues using traditional Notes/Domino components for a web application when a Servlet implementation could easily have saved the day.

As an aside on the subject of Servlets in Domino I came across the following line in the stdnames.h include file in the Notes 6.5 API toolkit.

#define DESIGN_FLAG_SERVLET                                'z' /*  FILTER: this is a servlet, not an agent! */

Hmmmmmm! Interesting, the ability to package a Servlet in an agent in a notes database (distribute via replication, no File System access for updates etc) very nice (if it happens).

2. Scheduled Agents

No problem.

3. Foreground Agents

If the agents do not interact with the UI then there is no problem. If interaction is required then they must either implement thei own UI interaction (AWT, Swing etc) or avoid doing the interaction directly.

4. Form, View and Databse Events

No, not unless you fire a Foreground Agent and don't need any interaction.

5. Stand Alone Applications for Client or Server


How To Use Java

It has to be said, the Notes Designer is not the slickest development environment in the world, particularly when it comes to doing Java. Use your favourite Java IDE and import your classes into Notes. Do use Java libraries, they are a great innovation allowing replication to distribute java packages and no need to put JAR files into the classpath - excellent (several of my non-domino Java developers drool when I explain how application deployment works in Notes/Domino).