Scripting the Java platform
January 3rd, 2008 at 12:47 pm by Arjen van SchieLately there has been more and more attention for scripting languages, watch the blogosphere and there are postings all over about Groovy, Scala, JavaFX and (J)Ruby. One of the reasons for this attention was the release of the JSR 223: Scripting for the JavaTM Platform. This made it a lot easier to integrate scripting languages into the Java platform.
Because of all this fuzz about scripting we decided to experiment a little with some scripting languages to position their value for Java software engineering. To investigate this value we gathered information about scripting in general and scripting in relation to Java. Then we developed a little toy-application to see how these scripting languages could be used together in one project.
We chose to implement a (scripted) calculator with Java, JRuby and JavaFX script. JavaFX is used for the generation of a GUI, JRuby for the extension points of the calculator (scriptable buttons) and Java for the primary calculations and glue between the environments/languages.
The conclusions of this little experiment are that JavaFX makes it possible to create fancy GUI’s and the built-in databinding is a real relief compared to the ‘event listeners’ in plain java Swing.
One of the disappointments is the lack of proper tooling, Netbeans provides plugins with some WYSIWYG, but is far from optimal. Another disappointment is the fact that JavaFX is not so stable, it appeared more then once that the JavaFX-interpreter created runtime-exceptions related to things like concurrent modification.
Conclusions concerning JRuby; this seems a lot more stable then JavaFX and it fits in pretty easily with the Java environment. JRuby is easy to use and the rubygems and all make it a nice environment to work in.
Note: The provided sourcecode is experimental and therefore does not necessarily comply with LogicaCMG rules and guidelines.
Popularity: 883 points


January 5th, 2008 at 2:11 am
James gosling :
How will JavaFX be positioned with regard to Microsoft Silverlight and Adobe AIR?
It certainly competes with both of those. I think we have a much broader and more capable API set. We’ve got a much stronger security story and cross-platform story and a really strong performance story. And I think our deliverable will be really nice.
(from http://reddevnews.com/qandas/article.aspx?editorialsid=121)
Fully agree with James. It’s nice. It’s even more than nice! Question is, does it lack maturity (the argument used by JavaFX competitors who might be right: please Sun release a decent version asap) or does it lack marketing. My less than five cents? Both!
January 7th, 2008 at 10:53 am
Well Okke, you already mentioned the important role of marketing and maturity. I trust Sun they will get a ‘production-ready’ version within a year, but I’m not so sure about their marketing-strategy.
But even so, when compared to AIR and Silverlight I think the battle will me much more about the way we can use them in a software project, especially with respect to the (GUI / interaction) designers. To truly support them, Sun has a long way to go in my opinion. MS and especially Adobe/Macromedia are both pretty well known for their WYSIWYG editors, whereas the current state of JavaFX editors is more like the opposite; Text-based editors with a preview. Which is not so intuitive for the not-so-technical designer, we need Flash/Photoshop like editors.
Also, James’s point about being more cross-platform might be true, but I’m not sure about the value of that argument when most people have a MS Windows based computer with Flash plug-ins etc.