Skip to main content

Scripting on the Java Desktop

Posted by joconner on July 26, 2006 at 5:00 AM PDT

I've ranted a little about scripting languages in the past, and although I still twinge at the name "Groovy", I'm beginning to recognize the utility of scripting in the Java platform. I even think desktop applications can benefit the most from a scripting environment.

What benefit? For starters, not everyone knows the Java language. Yeah, it's sad but true. Some developers are still hanging on to some other language...but we like them anyway. And we could really use their skills if we could just figure out how to integrate their code...too bad it's in PHP, Ruby, Perl, or JavaScript. However, now JSR 223 makes that possible. OK, maybe JSR 223 doesn't solve how to integrate people into your project, but it sure helps integrate scripting language components. And if you have people that can write code in JavaScript, PHP, Perl, Ruby, whatever, you can pull some of that stuff into your Java applications. Java SE 6 implements the java.script package APIs that make this possible.

In my opinion, the most important benefit by far is that you can allow customers to configure, enhance, tweak, and otherwise hack your applications. Oops, shouldn't have said "hack." Rewind. Restate. You can let them add customized functionality after you ship the product. The gentler learning curve for some scripting languages allows users to collaborate with you to create configurable, dynamic applications. That's good, right.

I put together an article that mentions other benefits of pulling scripting languages into the Java platform. The article also describes how to use the scripting APIs available in Java SE 6 (Mustang). The article
Scripting for the Java Platform
is on Sun's Java developer website. Sample code and a downloadable demo application give you lots of examples to understand the new scripting APIs. Happy reading.

Related Topics >>