Skip to Content
Learning Java, 4th Edition
book

Learning Java, 4th Edition

by Patrick Niemeyer, Daniel Leuck
June 2013
Beginner
1007 pages
33h 32m
English
O'Reilly Media, Inc.
Content preview from Learning Java, 4th Edition

Appendix B. BeanShell: Java Scripting

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 ...

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.
Start your free trial

You might also like

Learning Java, 6th Edition

Learning Java, 6th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Head First Java, 3rd Edition

Head First Java, 3rd Edition

Kathy Sierra, Bert Bates, Trisha Gee
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan

Publisher Resources

ISBN: 9781449372477Errata PageSupplemental Content