Importing Custom/External Packages or Classes for Domino Java Agent

Mindwatering Incorporated

Author: Tripp W Black

Created: 11/24/2004 at 10:36 AM

 

Category:
Notes Developer Tips
Agents, Java

In general, a Java agent can access a JAR file in one of two ways:

1. The JAR file is imported as part of the project. Any JAR file found as part of the agent will automatically be searched at agent runtime to satisfy class/resource references. It can be imported from the file system, or from a shared Java library.
(Note: If this doesn't work after an upgrade, it's probably because you need to update your JAR files for the new JDK that Notes/Domino uses. Otherwise, your compiles will work on the "old" Notes Designer client but not the "new" one.)

2. The JAR file is specified in the JavaUserClasses setting in Notes.ini. This amounts to having your JAR file added to the CLASSPATH for the JVM, not just your agent. Alternately, you could also put the file in the jvm/lib/ext folder on the server.So, just placing the JAR file with NCSO.JAR will do you no good unless you also mention it in Notes.ini.

Pluses / Cons of #1:
- Plus - The jars are with the database and won't be lost with client/server reinstalls.
- Con - Large jars make opening and save/compiling take a LONG time. If you use #2 instead, it is quicker.
- Plus - You can create a shared Script Library (Java) and then the compiled JARs are available to all agents that have imported the script library.

Plus / Cons of #2:
- Con - Can be lost on client or server upgrade/reinstall
- Plus - Faster for big JAR files.

Gotchas:
1. Version of JAR in Domino 6 may compile with project file, but not compile with Domino 7.
Normally, I'd say that the best, easiest thing to do it to just add the JAR file as part of the agent by either the "Edit Project" button in the Java Agent IDE, or via the "Import class files" button on the Imported Java Agent IDE. If doing that is not working, them I'd look at the JAR file creation itself (ie. what internal directory structure does it have), or what the base directory is during import. Look for the JARs going red when you refresh them during an "Edit Project" refresh; if you see this, this has probably happened to you.


previous page