Use custom java package


When scripting in LSC (see Scripting), you can import a java package and use its java classes within LSC JS engine. All you need is to add your jar file and its dependencies into LSC lib folder and import your package at the beginning of your script.

This tutorial shows how to set up a “hello world” type call.

Create jar file

  • In a folder, create folder path com/myjar
  • Add a file in myjar folder, containing :
package com.myjar;
public class Utils {
	public static String helloWorld() {
		return "hello world";
  • Compile : javac com/myjar/
  • Package : jar cfv myjar.jar com.myjar.Utils com/myjar/Utils.class

Adapt LSC to see and call your package class

  • Place myjar.jar file into your %lsc_home%/lib folder
  • Add this in your lsc.xml :
  • Result : The sn attributes of users are all populated with string “hello world”.