To make the existing code from Java script libraries available in XPages I use a LotusScript agent doing the following:
- extract compiled .jar files from Java script libraries (they are attached to design notes as "%%object%%.jar" files);
- convert the extracted files to Rich Text format (CD segments);
- import converted files into the folder WebContent/WEB-INF/lib in the database
as file resources using DXL (to create a new design element without a real content) + C API function
MailAddMessageBodyComposite (to embed CD file as rich-text into the just created design element).
That is why the agent it written on LotusScript: it is easy to call C functions from LS.
You have to run this agent after any modifications of Java script libraries to refresh
.JAR's in the WEB-INF folder.
To ensure that .jar files are imported successfully open the Java perspective in Domino Designer
and check the project folder WebContent /WEB-INF/lib. If the application was opened previously
in this perspective press F9 to refresh the application structure. If you ran the agent first time
and the application was opened in Domino Designer then you have to close and then reopen Domino Designer -
otherwise the new subfolder "lib" in "WEB-INF" still invisible in the application structure.
Notice that this solution became much less useful since 8.5.3 as there is a new design element:
Code\Java where you can write Java classes directly available in SSJS.