Sun CTO Bob Brewin on JavaFX Mobile and JavaFX Script
On this first day of JavaOne Sun displayed a renewed focus on client Java with the announcement of JavaFX. JavaFX is a complete runtime environment built on Java technology for delivering Rich Internet Applications (RIAs) to the desktop, mobile devices, handsets, and TVs. On each of these hardware platforms this new technology provides a scripting language designed expressly for rapid development of applications that combine the power of Java with flashy, interactive graphical user interfaces. But there is more to JavaFX than first meets the eye and it represents a remarkable new business strategy for Sun, as well as a new technology frontier. InfoQ got the chance to chat about this with Bob Brewin, Sun's Chief Technology Officer, who filled in some of the blanks about what it means to Sun, to Java developers, and to consumers, who are the real focus of JavaFX.
Asked what drove Sun to bring this technology to market at this time, Brewin didn't come back with the answer that many might have expected concerning the need for richer, faster-to-develop web content on the desktop. While it's pretty evident that JavaFX is an answer to the growth of Flash and AJAX, Brewin said the mobile phone and the TV screen are "closer to the user" than the desktop browser, and that in his mind these were the most important drivers of JavaFX. This echoed the morning's keynote message that Sun is placing new focus on consumer products in order to reach the widest possible market for Java technology. Brewin pointed out that in most of the world the primary means of accessing Internet content is not the desktop computer, but the mobile phone.
JavaFX is built variously on top of Java SE or Java ME depending on the target hardware platform, but in the Mobile version it is much more that a productive scripting interface for authoring interactive content—it is a complete operating system for the device, including a Linux kernel and native services. It should be seen as a competitor to Windows Mobile, Symbian OS, and other mobile Linux platforms. When running on a mobile phone JavaFX Mobile implements telephony services in Java that would be native in most mobile phones, so in this respect you can see its pedigree in the technology Sun recently acquired from SavaJe. The Linux kernel and CDC Personal Basis Profile Java runtime target high-end smartphone-class handsets as well as TVs and other connected devices, but Brewin says that as the runtime is optimized and perfected Sun will drive it down into CLDC MIDP "feature phones" as well. While the whole JavaFX software stack will be open-sourced soon, Sun expects to increase licensing revenue by selling complete device platforms instead of just Java runtime environments. A number of projects are in the works, including even a Solaris kernel for ARM processors found in most mobile devices today.
Asked about the genesis of JavaFX Script, Brewin noted that the language for scripting interactive GUIs was developed by Sun engineer Chris Oliver when he was at SeeBeyond Technology Corporation, which Sun acquired in 2005. Some developers will be familiar with it under its original name, F3. JavaFX Script is statically typed and provides compile-time error-checking, making it possible to develop powerful tooling with support for code-complete, hyperlinking, refactoring, etc. Other language features include type-inference, declarative syntax, and automatic data-binding with full support for 2D graphics and standard Swing components as well as declarative animation. You can also import java classes, create new Java objects, call their methods, and implement Java interfaces.
Authoring tools are still in development, but during the Tuesday keynote Chris demonstrated an interactive GUI builder for JavaFX Scripting that he had developed in JavaFX Script. This tool is included in the initial release of JavaFX to the developer community. The scripting language and tools are essentially the same across all the target platforms, so JavaFX seems to deliver on Sun's "write once, run anywhere" promise even better than Java itself. Of course, the Java objects that are imported and called within a JavaFX script will be dependent on the available Java runtime. When JavaFX is released for CLDC devices that have limited resources and lack Swing or AGUI libraries it will necessarily need to be somewhat pared down.
One concern about JavaFX on the desktop is the deployment story. The JRE is a huge download for a user that doesn't already have it installed and the current user experience for on-demand installation from the browser is not very good. Brewin fleshed out remarks made during the keynote to the effect that Java 6 Update 2 will introduce a new deployment model for the JRE where the initial download is very small and additional JRE components are lazily downloaded only as needed. He said that the concept is very similar to the Java Kernel project proposed for Java 7. Asked if a similar deployment scenario might be implemented for Java ME, he said it was certainly possible and that naturally this would be driven by the Java Community Process.
Asked how he would compare JavaFX to Adobe Flash, Brewin responded that it was a bit of an "apples and oranges" comparison. Flash clearly has the tooling end of things down, but was never intended to deliver the vast capabilities of the Java class libraries that are under the hood of JavaFX. He said the better comparison was between JavaFX and Apollo, Adobe's upcoming runtime for desktop RIAs. And on that playing field he thinks JavaFX will be very competitive.
Why JavaFX Mobile is not as good news as you think
Adobe already has the technology for the desktop/web