Script Execution Commands
Prev | Chapter 16. BeanShell Commands | Next

## Script Execution Commands

- `Thread bg(`String filename`)`;

  Run the BeanShell script named by `filename` in a copy of the existing namespace and in a separate thread. Returns the `Thread` object so created.

- `void exec(`String cmdline`)`;

  Start the external process by calling `Runtime.exec()` on `cmdline`. Any output is directed to the output stream of the calling process.

- `Object eval(`String expression`)`;

  Evaluates the string `expression` as a BeanShell script in the interpreter's current namespace. Returns the result of the evaluation of `null`.

- `bsh.This run(`String filename`)`;

  Run the BeanShell script named by `filename` in a copy of the existing namespace. The return value represent the object context of the script, allowing you to access its variables and methods.

- `void setAccessibility(`boolean flag`)`;

  If `flag` is `true`, BeanShell scripts are allowed to change and modify private variables, and call private methods. The default is `false`.

- `void setStrictJava(`boolean flag`)`;

  If `flag` is `true`, BeanShell scripts must follow a much more strict, Java-like syntax, and are not able to use the convenience features described in the section called “BeanShell's Convenience Syntax”.

- `void source(`String filename`)`;

  Evaluates the contents of `filename` as a BeanShell script in the interpreter's current namespace.

Prev | Up | Next
Resource Management Commands | Home | BeanShell Object Management Commands