Using LS2J

To use LS2J from within Notes®, your LotusScript® code must include this line:

Uselsx "*javacon"

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.

It is up to the LotusScript® client to load the LSX. The environment determines how the Java Virtual Machine (JVM) is set up and the limits on how LotusScript® can access the Java data.

LotusScript® locates the Java class files in two ways:

  1. In the Script Libraries that the user specified through the USE statement.
  2. On the file system as specified in the Notes®.ini variables JavaUserClasses and JavaUserClassesExt.

The value of JavaUserClasses is a semicolon-separated list of specifications, which can refer to JAR files, ZIP files, or CLASS file folders. For example;

JavaUserClasses = c:\LSI\test\java;c:\javautils\jdbcdrivers.jar; ... ;<specification_n>

The JavaUserClasses value string is limited to 255 characters. If you have a longer string, use JavaUserClassesExt. JavaUserClassesExt takes a comma-separated list of tags, each of which is set to a specification. For example:

JavaUserClassesExt = jdbc,string 
jdbc=c:\javautils\jdbcdrivers.jar 
string=c:\javautils\stringlib.jar

In the Notes® environment, LotusScript® locates Java classes and uses them as if they were LotusScript® objects. For example, if you have a set of common classes that are written in Java, you may use those classes in LotusScript® without modification.