Appendix B. BeanShell: Simple Java Scripting
In this book, I (Pat Niemeyer) have tried to avoid talking about specific software products or tools, other than those that are part of the standard JDK. However I’m going to make a small exception here to mention a nifty, free Java tool called BeanShell. As its name suggests, BeanShell can be used as a Java “shell.” It allows you to type standard Java syntax—statements and expressions—on the command line and see the results immediately. With BeanShell, you can try out bits of code as you work through the book. You can access all Java APIs and even create graphical user interface components and manipulate them “live”. BeanShell uses only reflection, so there is no need to compile class files.
I wrote BeanShell while developing the examples for this book, and I think it makes a good companion to have along on your journey through Java. BeanShell is a free software project, so the source code is included on the CD-ROM that accompanies this book. And you can always find the latest updates and more information at its official home: http://www.beanshell.org. BeanShell is also distributed with Emacs as part of Paul Kinnucan’s Java Development Environment (the JDE). I hope you find it both useful and fun!
Running BeanShell
All you need to run BeanShell is the Java runtime system. Under Windows, with SDK 1.2 or greater, you may simply double-click the JAR file icon to start the BeanShell desktop. More generally, you can simply add the JAR to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access