Over a million developers have joined DZone.

BeanShell Scripting with NetBeans IDE 7.1

· Java Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

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 by Stormpath—offering a pre-built Identity API for developers. Join Stormpath Java Developer Evangelist, Micah Silverman, on August 25th at 10am to dive deep into using JWTs to protect microservices from CSRF and more - sign up here.

Topics:

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

{{ parent.tldr }}

{{ parent.urlSource.name }}