I'm trying to use LS2J to invoke the Simple API for the ODF Toolkit (https://incubator.apache.org/odftoolkit/simple/index.html) from LotusScript, and I've been unable to use it properly.
I've included in a Java library called ODFDOM the following:
- odfdom-java-0.8.7.jar
- simple-odf-v0.4.5.jar
- Xerces-J-bin.2.11.0-xml-schema-1.1-beta.zip
With this code in the Sub Initialize of the agent:
Dim js As javasession
Dim jc As Javaclass
Dim jerr As JAVAERROR
Dim jms As JavaMethodCollection
Dim jobj As Javaobject, jdoc As JavaObject
Dim jm As JAVAMETHOD
Set js = New JavaSession
Set jc = js.Getclass("org/odftoolkit/simple/SpreadsheetDocument")
Set jm = jc.GetMethod("newSpreadsheetDocument", "()Lorg/odftoolkit/simple/SpreadsheetDocument;")
Set jdoc = jm.Invoke
execution gives an error:
JS2J Error: Threw java.lang.NullPointerException
Any clues about what am I doing wrong?
You have to "Use" your library "ODFDOM" and get your class in Java notation with dots. You can shorten your code with direct call of your static method:
UPDATE:
LS2J doesn't work with resources. Whenever you use resources in Java code it won't work with LS2J. After a short look into ODF Toolkit source code I saw resources used.
So, create an Java agent instead and call it from LotusScript.