BeanShell Scripting with NetBeans IDE 7.1

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 typescommands, and method closures like those in Perl and JavaScript.

NewFileDialog

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.

1323363005_Bildschirmfoto am 2011-12-08 17 49 35

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:

InteractiveConsole

 

Hexadecimal editor for NetBeans

For NetBeans IDE 7.1, there is a community contributed plugin available in the Update Center that adds a hexadecimal editor to NetBeans. The hex editor can be opened from the context menu of all filetypes.

nbhexedit-context

The editor shows the file content in hex and as text dump. The encoding of the text dump can be set anytime – a nice feature if you want to check the encoding of a given file.

ide-full

The editor is nicely integrated into the NetBeans Java IDE. Some problems are known if you use the plugin in C++ projects. Give it a try – it’s free. The source is available at sourceforge.net.