A great use for LS2J

For some time I’ve tinkered with the Lotusscript Java wrapper code (known as “LS2J”) in Notes 6.x, but have, until now, been somewhat non-plussed by it. The idea is a cool one, but genuinely useful code a little harder to discern, and the actual low-level implementation is somewhat iffy in places (just search the developerWorks Lotus forums for “LS2J” to see what I mean!).

Having said all that, the perfect use for LS2J has been brought to my attention by none other than Julian in his excellent LS2J examples database (go get it now!)

A while back I posted some stuff about the forthcoming version of OpenWiki on the OpenNTF site. Sadly real work took over, and I just didn’t get a chance to do any coding. Well, this weekend that changed. I’ve broken the back of it: I’ve completely re-written the wiki parser so that it uses regular expressions, and LS2J; Julian’s code made this possible. I now have a base custom Lotusscript class which utilises the power of the Apache Jakarta ORO regexp libraries to format and present wiki mark-up. So far so good, and I hope to unveil the new OpenWiki early in the New Year. Leveraging great code like this rocks…


  1. Bu coincidence I picked up on Julians stuff as well last week - looks good stuff - I had left LS2J alone as early versions seemed buggy - but if its settled down then maybe time to give it a second look.Steve Castledine#
  2. As always, thanks for the plug! I'm curious to hear about how well all that works for you, since I've mostly been just playing around with LS2J code at this point.

    In particular, I'm curious about performance. One thing I've noticed about Java in Notes 6.x (in general) is that the first time I run any Java agent after I've started the client, the agent takes about 3-5 seconds to "ramp up". After that, all the Java things that I do seem to run right away. While it's a big improvement from R5 (where everything seemed to have a delay), it's still a little annoying.

    Anyway, I'm glad you liked the code and found a good use for it. If nothing else, the nice thing about LS2J is that you can use all your Java toys and still access the Domino objects in LotusScript, avoiding all the recycle mess you'd normally need to deal with in Java.

    - Julian
    Julian Robichaux#
  3. Hi Julian. Re performance, that's exactly what I've found, yes. The first time you run the code after saving a new iteration of it, there's a lag. Thereafter it's fine, even between re-starts (this is just in the client: haven't tested the new code on the web yet).

    Interesting, because Designer compiles when you save, or at least that's always been my impression (maybe the status bar lies! ;-) )

    The lag is akin to a web page taking its time due to new JSPs compiling the first time anyone hits that page. Odd.Ben Poole#
  4. Hi,

    I'm working with LS2J and I'm having a hard time! I've got a number of java classes and a number of LS agents. I need to make use of the Java classes, however I found out it's not possible to pass a "NotesDocument" or a "NotesSession" as a parameter to a Java class. For example, I have a java class whose contructor is:

    public class Test(lotus.domino.Session)

    I found out we cannot do something like:

    Dim session As New notessession
    Set jSession = New JavaSession
    Set pbClass = jSession.GetClass("Test")
    Set pb = pbClass.CreateObject("(Llotus/domino/Session)V", session)

    Is there a way to map this objects?

    Thanks a lot!Aurelio Calegari#
  5. I'm having the same problem as Aurelio.. 4 years later!

    Any hints?Brendan#
  6. Use a Java agent…
    LS2J sucks…Brian#

Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.