Over a million developers have joined DZone.

BeanShell Scripting with NetBeans IDE 7.1

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

For NetBeans IDE 7.1, there is a community contributed plugin available in the Update Center that adds support for the BeanShell scripting language.

BeanShell (http://www.beanshell.org/) is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. It has been developed by Pat Niemeyer and released as (JSR-274).

BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript.



The BeanShell plugin for NetBeans integrates seamlessly into the IDE. Within a usual Java SE project, you'll find a new BeanShell script filetype in the "New File" dialog. These files with a .bsh extension contain the scripts. BeanShell scripting uses default Java syntax, so you could write some lines of test code right away. The scripting features of BeanShell script make it quite fun to use and to experiment with.

Syntaxhighlighting and Navigator integration

One really useful feature of the plugin is the interactive scripting console. The fact that BeanShell and Java share the same syntax makes it possible to execute snippets of Java code in the scripting console. This comes in handy if you, e.g., just want to check some small piece of code and don't want to setup a test application or a JUnit test for that. You can find the scripting console window at Window/Other/BeanShell:

Interactive console

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}