Wednesday, October 24, 2007

Java Bean Shell

Java Bean Shell is a handy tool for Java programmers to test APIs, regular expressions, and other small code snippets. In particular if you are working on Client-Server architecture, it takes long time for you to test small changes in the back end. Though Java is compiled language, the interpreter tool in BeanShell will let you interpret the code. It can be downloaded from http://www.beanshell.org/ .

Demo

//to start Console
$ java -classpath ./bsh-2.0b4.jar bsh.Console
//to start Interpreter
$ java -classpath ./bsh-2.0b4.jar bsh.Interpreter
bsh % import java.io.Decoder;
bsh % String dir = "%2Fhome%2Fcodeshepherd";
bsh % System.out.println(dir);
%2Fhome%2Fcodeshepherd
bsh % System.out.println(Decoder.decode(dir));
/home/codeshepherd


The Interpreter does not support history and coloring. But the Console does. But the output from Console is thrown in the parent shell.

1 comment:

Gianna T said...

Thoughtful blog thanks for sharing.