Put jar file anywhere in file system of Domino server. Add location of these jar files to notes.ini → JavaUserClasses variable. If multiple JAR files are there add them separated by comma.
This is not an anwser to the OP’s question. The OP wants to know how to place the Jar in an NSF. I think what the OP is trying to attempt is to place security on the JAR. Placing the jar in the filesystem would allow anyone that has acccess to the server to run the servlets if placed on the file system.
Holm, I have been wanting to do this myself. I hope you get an answer.
thanks for your quick response but as Bruce wrote: this is exactly what I don’t want to do!!!
The problem is the following: I coded something for a customer. I will take the nsf file, copy it with notes and the whole stuff works on the fly without altering the ini file, restarting domino, etc.
There must be a way to put it into the nsf file and use it.
I don’t think that there is any way to use a jar stored as a file resource. You can however import it into a Java ScriptLibrary and make it available to Java agents that way.
Thanks to Harkpabst here is a step by step solution how it works: Remember: I want to add a jar library to an nsf file.I DON’T want to add the jar library to my CLASSPATH neither on my computer nore on my server.
Here is how it works:
Important: I have Notes 7.0 so everything should be compiled in Java 1.4, Notes 7.0 can not handle
JDK > 1.4
How to do that?
e.g. in Eclipse you can change the compile modus under Window - Preferences - Java - Compiler and
change the “Compiler compliance level” to 1.4 - recompile all java files
next is you create a jar library: e.g. in Eclipse you right click on the project and choose Export - Jar library …
save the jar library
under windows (via a command shell) or linux (via a shell) go into the directory where you saved the jar library
under windows rename the file → ren oldfile.jar newfile.zip
same under Unix → mv oldfile.jar newfile.zip
unzip the file with your favorite zip program
Open the Designer and the corresponding database where you want to store the classes
go to Shared Code - Script Libraries
Choose New Java Library
Choose Edit Project (you see the button at the bottom)
on the left site choose “Local File System” and click on the directory button
navigate to the folder where you unzipped the jar (zip) file
ATTENTION: if your java package is called, e.g. org.java.twain.* you have to navigate to the root of org,
otherwise notes will not find the package
left click on the package name (highlight it … here in my case “org” is highlighted)
click on checkbox “Show file types” “All” und push the “Add/Replace File(s)” button
all classes should be now in the right window
click “OK” and click “Save” - give the library a unique name (in my case: twaindriver)
go to the Java-Agent
click on “Edit Project”
change on the left “Browse - Local File System” to “Browse Shared Java Libraries”
you should be now able to see the name of the package name under you saved all class files
highlight the package (in my case: twaindriver) und push button: “Add/Replace File(s)”
the Library should be now on the right site
you should be now able to import the classes: in my case import org.java.twain.*
Subject: RE: SOLVED: Include jar library in nsf file
Well, it SHOULD actually work without unzipping the jar file.
In the “edit project” dialog, just pick the right base directory that holds the jar file and click OK. Do NOT expect the actual files to show up in that dialog (although it looks like a regular file selector).
Next make sure, that in the “show file types” sections, “archives” (and only archives) is checked. You should now see all the jar files in your base directory inside the very same dialog.
Select whatever you need and hit “add or replace files”.
If necessary, reorder your inputs on the right side of the dialog.