DukeScript brings Java to HTML5, JavaScript

Framework lets developers build HTML5 and JavaScript applications while leveraging Java

JavaScript words

DukeScript, its name derived from Duke, the Java mascot, gives Java developers a way to build HTML5 and JavaScript applications within the comfort of the Java language.

Released earlier this month, DukeScript 1.0 is a framework for developing cross-platform mobile, desktop, and Web applications. These are Java applications that internally use HTML5 technologies and JavaScript for rendering.

"The technology is client-side technology," DukeScript inventor Jaroslav Tulach, a NetBeans platform architect at Oracle, said this week at the JavaOne conference in San Francisco, which has a multitude of JavaScript sessions this year.

Developers can write Java code while leveraging the latest developments in modern UI technology. DukeScript can combine with frameworks such as Bootstrap to provide responsive layouts. DukeScript also supports the Knockout JavaScript framework, along with technologies such as the canvas API.

On the desktop, DukeScript leverages the HotSpot VM to run Java code; on Google Android devices, the Dalvik VM is used; and for Apple iOS devices, RoboVM technology enables DukeScript. "The problem on iOS is you cannot do dynamic code generation, but that's exactly what RoboVM avoids," Tulach said.

For enterprise applications, DukeScript enforces a separation of concerns, using HTML for the view and Java for business logic while integrating with Java EE (Enterprise Edition) and other back ends.

Any improvements to DukeScript, meanwhile, will be driven by need, said Tulach. But developers of DukeScript would like to see more converted JavaScript libraries. "The whole system is modular, so we don't put these libraries into the code," Tulach said. DukeScript can work on Chrome, Safari, and Firefox browsers but is slower on Firefox.

Among the apps built with DukeScript are a Minesweeper game, used to demonstrate DukeScript running on any device with a responsive design, and Leaflet4j, an API for interacting within maps in an application and featuring interaction with the JavaFX rich client technology.

"We don't want to limit you to the technologies we like or support directly. It's dead simple to extend DukeScript with your own ideas," the DukeScript Web page emphasizes.

From CIO: 8 Free Online Courses to Grow Your Tech Skills