This article was published in the Borland
Community web site on November 15, 1999
These articles about open-source software appeared every Thursday in Borland Developer News between September 1999 and June 2000.
Launching a full-blown IDE for a brief Java programming excursion can be like driving the car to a nearby shopping mall. If you have ever imagined the equivalent of a Java bicycle, your fantasy may have come true with BeanShell v. 1.0.
I'd just moved to Davis, California, and it was the first time I'd gone shopping. I parked my bicycle in an empty rack, dashed in, grabbed the few things I needed, and found a checkout register.
"Sorry?" The salute was unexpected, and the tinny accent of the northern-California girl didn't help.
"Paper-or-plastic?" she repeated, more slowly this time. But it wasn't until the third time that I understood.
"Oh! Paper bags will be OK. Thanks."
The reply "You bet!" was another surprise, but I didn't ask for translation. I paid, gathered my stuff, and hurried out, glad I could cycle home quickly with my groceries.
As a young programmer, I was always in a hurry, and if there's a heaven for bikers, it is the little town of Davis. My apartment was well within walking distance of the shopping mall, but I preferred to ride. It took only a few minutes to reach the mall by bike, most of them spent waiting at the Russell Avenue crossing. Driving would have been overkill for such a short trip -- especially considering the effects on the ozone layer -- and probably the most time-consuming of the options.
I've often felt that launching a full-blown development environment for a brief Java programming excursion is like taking the car out to go to the nearby mall. Yet going about with just a text editor and the command line compiler seems too cumbersome, too much like going on foot -- especially if the task at hand is not trivial, or if it's one of those days when one out of ten key-presses is a typing error. The solution I've imagined would be something equivalent to a Java programming bicycle.
I went Web-spelunking and found a beta version of what promised to be the ideal solution to my short programming excursion needs -- someday. Then, just a couple of weeks ago, I was notified by e-mail that BeanShell 1.0 was available. I decided to take the tool for a ride.
BeanShell comes with both GUI (Swing) and console mode interpreters. The GUI interpreter provides command history recall, command line editing, cut and paste, support for multiple sessions, and a simple editor for scripts.
BeanShell can also be embedded into your applications to provide them with scripting functionality. The core interpreter, with all console functionality removed, fits in a 135K Jar file. The tool also provides a "server mode," which allows for remote access to the interpreter using HTTP. Upon gaining access to the specified TCP port, BeanShell will send back a remote console applet that can be used to query or change the state of the running application in which BeanShell is embedded. It's also possible to talk to the interpreter in terminal mode by using the Telnet protocol.
The documentation, which is available from the BeanShell Web site, includes the script language's syntax, the built-in commands, and instructions for installing, running, and embedding the tool. A set of JavaDoc pages covers the product's internal API. There is a mailing list for BeanShell users and developers on the site as well.
With BeanShell at hand I can easily experiment with libraries and classes I develop or download from the Internet without recompiling, and without bothering to set up a new project in the IDE. As it turns out, my Java bike was not just a fantasy after all.
Originally written for In Publishing LLC
Copyright © 1999-2012 Juancarlo Añez, Caracas, Venezuela.