The lotus notes help has lots of information on how it works, I found out about when writing systems to handle and manipulate jpeg images for a photographers web site which automatically creates thumbnails, black and white copies of images, get image height and widths automatically, slideshows for customers and lower quality images for customer viewing over the web.
I also have written a digital image library which calalogues pictures by who is in it and automatically makes thumbnails etc.
The library and example on nsftools is pretty good: http://www.nsftools.com/blog/blog-11-2004.htm#11-19-04
(There are also ls2j routines for FTP, multithreading and regular expressions.)
To use LS2J from within Notes, your LotusScript code must include this line:
Uselsx "*javacon"
and a Use line for the java library in the options section. eg: Use "JpgImage"
This loads the LS2J Dynamic Link Library (DLL) on Win32 and registers all the Application Data Types (ADTs).
LotusScript provides a JavaSession ADT to be used as an instance to connect with the JVM.
This statement:
Set mySession = New JavaSession
creates a new Java session. If the JVM has not been started, one is created at this time.
Anyway all this is covered in the help, one thing that isn't is if you want to access overloaded java methods.
NB overloaded method, is a method with the same name but takes in different parameter types or classes.
In the nsftools JpgImageTest agent comments:
'** sendToFile is also overloaded, so we have to go the long way for
'** that method too
Dim sendToFile As JavaMethod
Set sendToFile = jpgClass.GetMethod("sendToFile", "(Ljava/lang/String;)V")
Call sendToFile.Invoke(jpgImage, newFileName)
the above code access the java method:
public void sendToFile (String fileName) throws IOException
Sendtofile basically saves the manipulated jpeg image with a quality of 0.75.
There is another method which saves the file with a set jpeg quality, I needed this for a project.
The overloaded java method has an extra parameter:
public void sendToFile (String fileName, float quality) throws IOException
To set this up you need to change the JNI signature "(Ljava/lang/String;)V" in the GetMethod call.
I eventually worked out that I needed to change it to: "(Ljava/lang/String;F)V"
There is a Lotus Notes developer help page that shows the different JNI values, but no mention of how to do multiple parameters.
The V stands for void as in the return value (or not in the cse of void). The prefix L means there is a class coming up, while F means float and I would mean int.
JNI multiple parameters are separated by ; and then input parameters are surrounded by brackets.
Anyway I hope that helps someone out. If you find any more LS2J examples or errors please let me know!
I hope to add some more myself soon, including GIF manipulation etc.
LS2J errors:
LS2J Error: Illegal signature. This means the JNI signature is in the wrong format in the GetMethod call. See above.
java.lang.NoSuchMethodException: This means the java method name or method and JNI signature combination cannot be found in the java class or library.