Coming soon: Open source JavaFX for iOS, Android
Will enable cross-platform Java-based UIs – but why?
Oracle says it plans to open source the Android and iOS implementations of its JavaFX UI platform "over the next couple months," which it says will allow Java developers to use the technology to write cross-platform smartphone apps for the first time.
"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," Richard Bair, chief architect of the Client Java Platform at Oracle, wrote in a blog post at FX Experience.
Before that can happen, though, there's still work left to do to open source the core JavaFX platform. Bair says Oracle has made good progress on that effort, but there remain important milestones to complete.
Specifically, Bair says the team plans to release the remaining code for Glass (the JavaFX windowing toolkit), Prism (the scene rasterizer and renderer), the web rendering component, and a few other APIs over the next one to two months.
That leaves the JavaFX font renderer as the last sticking point. Currently, javafx-font relies on proprietary technology licensed from Bitstream, but Bair says the OpenJFX team is working on developing a replacement that will achieve the same results using native OS system calls.
If all goes according to plan, a fully open source version of JavaFX should arrive in the first quarter of 2013, just missing the late-2012 deadline that was announced at last year's JavaOne conference.
What remains to be seen, however, is whether an open source JavaFX will really do much to spur interest in the platform – something that Oracle, like Sun before it, has struggled to achieve.
JavaFX was originally pitched as a framework for writing so-called rich internet applications (RIAs). We don't hear much about those anymore, given the rise of HTML5, and even at its launch JavaFX met with a mixed reception.
But the technology has undergone multiple substantial rewrites since then, and these days Oracle is positioning it as the default UI layer for all of Java SE, which includes Java Embedded. JavaFX has come bundled with the Java Development Kit (JDK) since Java 7 Update 6 in August 2012.
While that's all well and good, interest in Java desktop applications remains low. Mobile platforms are the new hotness, but getting mobile app developers interested in JavaFX could be even more challenging than enticing desktop coders.
Oracle demoed a JavaFX game running on iOS at JavaOne 2012, but it made it clear that the app was just a proof of concept and that there were no immediate plans to ship an official version of JavaFX for either iOS or Android. According to Bair's comments on Monday, that hasn't changed.
Still, Bair says the open source release of JavaFX will give mobile developers access to the technology, even if it isn't formally supported by Oracle.
"This is also why we've been prioritizing open source so highly for the last little while, when OpenJFX can be built without any binary stubs, then there is nothing stopping you from taking OpenJFX with iOS port + OpenJDK and creating commercial applications that can be sold in the iOS app store," Bair wrote.
Nothing? Well, not quite. There are still a few roadblocks to widespread adoption of JavaFX among iOS developers, both technical and logistical.
Java and JavaFX on iOS? Maybe not
First, using JavaFX isn't the most practical way to build an iOS app. Because iOS doesn't ship with a Java Virtual Machine (JVM) and JavaFX is implemented in pure Java, using the technology means iOS developers must embed both the JavaFX libraries and a lightweight JVM into their apps. That could potentially result in multiple, redundant copies of the JVM running on the same device.
Not to mention that outside of Oracle, no one has seen this particular JVM yet. Bair says his team's JavaFX ports for mobile platforms "are based on an as-yet unreleased version of JavaSE Embedded for iOS/Android," so we can't be sure what its capabilities are.
Second, Apple still places restrictions on the types of software that can be sold through the iOS App Store. Most notably, virtual machines that do Just in Time (JIT) compilation are forbidden, which could limit the real-world performance of Java, and by extension JavaFX.
Third, the licensing issues around OpenJFX and the App Store aren't clear. The open source versions of JavaFX and the JDK are licensed under the GPLv2 with the Classpath Exception. Cupertino has booted GPL-licensed software from the App Store in the past because the license conflicts with Apple's own terms of service.
Bair says "his understanding" is that the Classpath Exception means you should be able to link the JavaFX code libraries into your own apps, release the apps under your own license, and sell them through the app store without violating Apple's terms. But even he isn't 100 per cent sure, and he hastens to add that he's not a lawyer.
But perhaps the most significant reason why JavaFX is unlikely to take off among iOS developers is that there simply isn't any compelling reason to use it. Apple provides a native UI toolkit for iOS, and developers who prefer a cross-platform technology already have a perfectly workable solution in HTML5.
According to recent research by Gartner, by 2016 more than 50 per cent of all mobile apps will be so-called hybrid apps, built using a combination of native application logic and a UI layer based on HTML. Given that HTML rendering is supported by every modern smartphone platform, there's little incentive to bolt on something extra, such as JavaFX.
Still, niche UI tools and frameworks have enjoyed some success among games developers, and Oracle may be hoping to tap into that market with JavaFX, rather than selling it to productivity-app developers. If that's the case, however, there's a lot more work to be done before JavaFX is a viable competitor to the likes of Unity or ShiVa3D.
The question is whether Oracle is willing to do that work. The efforts of Bair's team to open source JavaFX are commendable, but until Oracle is willing to commit to a formal release of JavaFX for mobile platforms, developers aren't likely to have much faith in its future, either. ®