In this book, we (in this case, I, Pat) have avoided talking about many third-party tools that aren’t part of the standard JDK. I’m going to make an exception here to give a shout out to 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, expressions, and even classes—on the command line or evaluate bits of source code from within your applications. 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 fun companion to have along on your journey through
Java. BeanShell is an open source software project and at the time of this writing is
in the process of being adopted by the Apache foundation. You can find the
latest updates and more information at its current home. Over the years,
BeanShell has been a popular tool and has been widely used in tools and
projects that require scripting. However, today there are probably better
options for serious scripting integration with Java. For example, you may
wish to look at Jython, an implementation of the Python scripting language,
as another option. Many scripting languages can be accessed in a plug-in/
provider fashion using the java.scripting
API
(JSR-223). The JDK 7 is bundled with the Mozilla Rhino implementation of
JavaScript, as another option.
Get Learning Java, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.