FileDocCategorySizeDatePackage
BSFSample.javaAPI DocExample757Sat Mar 13 14:14:46 GMT 2004None

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("jython",
			"org.apache.bsf.engines.jython.JythonEngine", fntypes);

		try {
			// try an expression
			Object r = manager.eval("jython", "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;