FileDocCategorySizeDatePackage
BSFSample.javaAPI DocExample822Thu Feb 01 15:19:34 GMT 2001None

BSFSample

public class BSFSample extends Object
Sample of using Bean Scripting Framework with JPython

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		BSFManager manager = new BSFManager();

		// register scripting language
		String[] fntypes = { ".py" };
		manager.registerScriptingEngine("jpython",
			"com.ibm.bsf.engines.jpython.JPythonEngine", fntypes);

		try {
			BSFEngine jpythonengine = manager.loadScriptingEngine("jpython");

			// try an expression 
			Object r = manager.eval("jpython", "testString", 0, 0, "22.0/7");
			System.out.println("Result type is " + r.getClass().getName());
			System.out.println("Result value is " + r);
		} catch (Exception ex) {
			System.err.println(ex.toString());
		}
		System.out.println("Scripting demo done.");
		return;