Download BeanShell User's Manual

Transcript
Quick Start
Welcome to BeanShell. This is a crash course to get you going. We'll leave out many important options and
details. Please see the rest of the user's guide for more information.
Download and Run BeanShell
Download the latest JAR file from http://www.beanshell.org and start up BeanShell either in the graphical
desktop mode or on the command line.
If you just want to start playing around you may be able to launch the BeanShell desktop by simply double
clicking on the BeanShell JAR file. More generally however you'll want to add the jar to your classpath so
that you can work with your own classes and applications easily.
To do this you can either drop the BeanShell JAR file into your Java extensions folder or add it to your
classpath. (Important: If you put BeanShell in the extensions folder and wish to use it with BSF applications
like Jakarta Ant you must install the bsf.jar in the same location).
To install as an extension place the bsh.jar file in your
$JAVA_HOME/jre/lib/ext folder. (OSX users: place the bsh.jar in
/Library/Java/Extensions or ~/Library/Java/Extensions for individual users.)
Or add BeanShell to your classpath like this:
unix:
windows:
export CLASSPATH=$CLASSPATH:bsh−xx.jar
set classpath %classpath%;bsh−xx.jar
Tip:
You can modify the classpath from within BeanShell using the addClassPath() and setClassPath()
commands.
You can then run BeanShell in either a GUI or command line mode:
java bsh.Console
// run the graphical desktop
java bsh.Interpreter
// run as text−only on the command line
or
or
java bsh.Interpreter filename [ args ] // run script file
It's also possible to call BeanShell from within your own Java applications, to reach it in a remote server mode
for debugging, to use it as a servlet, or even in an applet. See "BeanShell Modes of Operation" for more
details.
The BeanShell GUI
The BeanShell GUI desktop is meant to allow some experimentation with the features of BeanShell. It is not
intended to be a replacement for a full featured IDE. Please check out the jEdit editor for an example of a full
featured development environment based in part on BeanShell scripting capabilities.
Upon starting the BeanShell in GUI mode a console window will open. By right clicking on the desktop
background you can open additional console windows and other tools such as a simple class browser.
Quick Start
8