About Referencing External Java Classes and Scripts

User-defined Java classes can be referenced from scripts.

User-defined Java classes can be referenced from scripts by making the JAR file containing the classes an input File parameter of the component (for a Script component, or a Prologue or Epilogue script of any component). The JAR file is automatically added to the class-path of the Script Interpreter, allowing the class to be used.

For example, if you have a file test.jar containing class test.Play , you could use it from a script as follows:

Jython:

from test import Play
p = Play()
p.function(args)

Dynamic Java:

p = new test.Play();
p.function(args);

The working directory of the component is also added to the class-path, so any .class files written to this directory are available from scripts. In addition, for Jython, Python files with extension .py can be referenced from scripts as modules.

For example, if you have a file play.py that contains the line abc = "this is my play module" and you add it as a File parameter of the Script component, you can reference it from a Jython script with:

Jython:

import play
msg = play.abc