Oracle Announces Open Source JavaFX for iOS and Android

Oracle has announced plans to open source the iOS and Android implementations of its JavaFX UI platform "over the next couple of months", allowing developers to use the technology to write cross-platform applications for those platforms for the first time.

Richard Bair, chief architect of the Client Java Platform at Oracle, wrote in a blog post at FX Experience,

A majority of you said you'd contribute to an iOS / Android port (either via bug reports or direct code contributions) and we're working hard to be setup so that when the code is opened you'll be able to start in on it.

The first bits and pieces for iOS should be out next week, but before the complete release other parts of the JavaFX stack also need to be made available as open source.

When Oracle announced plans to make the complete JavaFX stack available as open source software at last year's JavaOne it stated that it intended to complete the work by then end of 2012 - something which Bair said "...was a pleasant surprise to me...as much as to everybody else in the audience".

Since then some 543,055 lines of code, representing 35 different sub-projects, have been released in re-licensed form. Bair says the team expects to release the remaining code for the JavaFX windowing toolkit Glass, and the scene rasterizer and renderer Prism, along with the web rendering component, image I/O and media sources, over the next one to two months. The one remaining sticking point is the JavaFX font renderer javafx-font, which relies on proprietary technology licensed from Bitstream. To solve this, Bair states that the team are working on a plan to replace the Bitstream technology with direct calls to the native operating system.

Writing on his blog Dustin Marx, principal software engineer and architect at Raytheon Company, argues that, "Being able to develop Android and iOS applications with JavaFX will likely be a game-changer for JavaFX," a sentiment echoed by Anahata Technologies.

If these efforts are successful, software vendors around the world would be able to use one single code base to deliver applications for mobile devices running iOS, Android or Windows RT, desktop computers and laptops.

"I am looking forward to seeing what you all will do with this contribution, and hope to be running many Java apps on my phone / iPad in the near future," Bair adds.

There are still both technical and legal challenges to getting JavaFX-based applications into the Apple-curated iOS App Store however. On the legal side, the interplay between Apple's terms and Oracle's use of the GPL for licensing give some cause for concern. The open-source versions of JavaFX and the JDK are licensed as GPLv2 with the classpath exception. Apple has removed an iPhone port of a game, GNU Go, from the App Store that was licensed under GPL, in response to a complaint from the Free Software Foundation (FSF). FSF argued that the store's terms of service, in particular that a piece of software downloaded from the store can only be used on five devices, contradicted the GPLv2. Unsurprisingly, rather than changing its terms, Apple simply pulled the game.

Now Bair says "his understanding" is that the classpath exception means you should be able to combine OpenJFX and OpenJDK (minus any binary stubs released under a different license) with your application and release under your own license as a single co-bundle. There is a precedent for this - Apple has allowed an OpenJDK powered application, Cyberduck, into the Mac App Store - but Bair himself points out that he isn't a lawyer, and he isn't 100% certain.

Technically, of course, bundling in this way also means multiple copies of both the JVM and the JavaFX libraries running on the same relatively constrained device. The JVM involved is expected to be lighter-weight than the full version - "Both our ports are based on an as-yet unreleased version of JavaSE Embedded for iOS/Android," Bair states. We won't, of course, know how lightweight until it is released. And moreover Apple's restriction on virtual machines that do JIT compilation makes it likely that JavaFX applications will struggle performance-wise.

JavaFX also faces some stiff competition in the mobile space. Developers wanting to go cross platform using free and open source technologies can use HTML5 and frameworks such as PhoneGap, whilst for game developers JavaFX is some way from being a serious competitor to proprietary alternatives such as Unity and ShiVa3D. The efforts of Bair and his team are laudable, but unless Oracle commits to a more formal release for JavaFX on mobile platforms, it is hard to see it getting much traction.