16.1. Running BeanShellBeanShell started as a scripting language with a Java-like syntax, although it has recently been expanded to be completely Java-compatible. This new functionality will be discussed shortly. BeanShell may be used in two ways: as an application or as an API. Although the language itself is the same in either case, the principles are best demonstrated in application mode. Within application mode BeanShell may be run either within a console or in its own Swing-based window. The latter may be invoked by adding bsh.jar to the CLASSPATH, and running java bsh.Console This will bring up the window shown in Figure 16.1. Figure 16.1. The BeanShell GUI.Chapter 3. This view is shown in Figure 16.2. Figure 16.2. The BeanShell class browser.This works in the obvious way: a hierarchy can be clicked to display a list of classes, and a class may be clicked to bring up a list of methods. The console version of BeanShell is started as java bsh.Interpreter This will present a prompt much like a single workspace, except that the arrow keys will not work. The interpreter may also be given the name of a file containing BeanShell expressions and commands. It will evaluate these expressions in order and then exit.
|