Few days back,I've tried domiclipse plug-in with Eclipse to test if I can continue my development in Eclipse.I was really impressed with the way my Eclipse started talking to my local( and server ) databases.However, I've found difficulties in accessing Domino objects within Eclipse environment.Also,When I try to sync my work with Notes database , It just creates java class files in my local but doesn't update notes database directly ( I assume need to use "Imported Java" agent to manually upload in domino agent ).
Today I was reading about NotesFactory() class in Domino and found using this class Domino objects can be read/write from Java IDE.Next, I found "Running a Java Program" topic in the help file, which clearly says there are two jar files Notes.jar and NCSO.jar which can be configured in any IDE to access domino objects.I got excited and spent couple of hours to configure Eclipse to access Domino Objects. Finally I've done, Here are those easy steps to accomplish;
1)At very first step, Your machine should have Eclipse setup. You can get it at Eclipse Website
2)Run-time requirements
A computer running a Java application that makes local Domino calls must contain Domino Server, Domino Designer, or Notes Client, and must include Notes.jar in the classpath.
A computer running a Java application that makes remote Domino calls need not contain Domino or Notes, but must contain one of the NCSO archives and must include it in the classpath.
A computer running a Domino agent that makes Domino calls must include Notes.jar in the classpath.
A computer running an applet that makes Domino calls needs no Domino software or classpath assignments. The applet must be loaded from a computer containing a Domino server.
For this example I assume you've Client and Server running on the same machine.
3) Find Notes.jar(for me,C:\lotus\Notes\jvm\lib\ext) and NCSO.jar(for me,C:\Program Files\IBM\Lotus\Domino\data\domino\java) file paths and add in your ClassPath (How to set ClassPath for Java)
4) Start Eclipse, go to File->New->Java Project
4) Right click on newly created project,Choose Properties->Java Build Path and add external Jars.
5) Create new class, Right click on project->New->Class
6) Here is the sample code which I've tried,
import lotus.domino.*; public class AccessDomino { public static void main(String[] args) { try { Session session = NotesFactory.createSession("localhost", "Rishi Sahi/Development", "Development"); Database db = session.getDatabase(null, "ConnectmetoDomino.nsf"); System.out.println(session.getUserName()); System.out.println(db.getSize()); } catch(Exception e) { e.printStackTrace(); } } ; } |
* At very first line I'm importing domino package which contains all the necessary class/methods to start my work.
* I'm using NotesFactory class to create domino session with ServerName,UserName and Password parameters.
* Once session is created use any Domino-Java class to start your work.
One of the main advantage you can attain to use type ahead feature which is still missing in Domino.
7) Before running your program you must ensure that the server notes.ini file contains the following line:
ServerTasks=
If missing then open Notes.ini file and add diiop in your server tasks list and restart domino server. Once done, run your code and check the output,
You can ease your Domino-Java development using domiclipse and above tips.
To setup domiclipse, I would suggest to visit : Coding Thoughts by Carlos