LOTUSSCRIPT LANGUAGE
1. Create a Java Script Library called xlib containing the following:
public int add(int a, int b) { return a + b; }
public int div(int a, int b) { return a / b; }
public int mul(int a, int b) { return a * b; }
public int sub(int a, int b) { return a - b; }
}
Use "xlib"
Uselsx "*javacon"
Sub Initialize
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim calculator As JavaObject
Dim a,b,c As Integer
Set mySession = New JavaSession()
Set myClass = mySession.GetClass("calculator")
Set calculator = myClass.CreateObject()
a = 10
b = 5
c = calculator.mul(a,b)
MessageBox "a * b = " & c
End Sub
Description of the USE statement
The syntax of the LotusScript USE statement is:
The Use statement examines the type of the Script Library. If the Script Library contains LotusScript, processing proceeds as before. If the Script Library contains Java classes, the contained Java classes are available to the LotusScript program by using LS2J.
Note The restriction on using the LotusScript "Use" statement to incorporate a Script Library containing Java has been lifted.
See Also