I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 639 posts at DZone. You can read more from them at their website. View Full User Profile

JavaFX Goes Mobile

  • submit to reddit

Today sees the release of JavaFX 1.1, allowing developers to put their JavaFX RIA applications on mobile phones, as well as the desktop. I talked with a few of the folks at Sun, including Param Singh, Senior Director of JavaFX at Sun, John Burkey, JavaFX Architect and Mandini Romani, who runs the JavaFX platform.

In this article I'll go through what's included in this release, as well as ask find out a little more about the things in JavaFX that I've wondered about - mostly the integration between Swing, or SWT, and JavaFX.

Ever since the release back in December, targetted at web and Ajax developers, as well as Java developers, has been well received. With around 100,000 downloads of the SDK and over 80 million downloads of he JavaFX runtime distribution, it seems that the community has accepted the first version.

What's New In This Release

Mobile developers, who traditionally created their applications with Java Micro Edition are now catered for with the 1.1 release of JavaFX. There will be a revision to the SDK, with some new things on the desktop side, but the emphasis is on mobile. The important thing to note here is that it's one SDK for both desktop and mobile. So this is really an opportunity for Java everywhere, and you can single source your RIA application with this single development model. This is a major differentiation between JavaFX and Flex, where the Flex community has Flex Lite for mobile devices.

There's a mobile emulator included to allow testing before deploying. A mobile-specific section of the JavaFX API is also provided to allow optimization and customization of your application for the mobile environment, if you wish.

Getting Partners On Board

The JavaFX runtime will be delivered to some target partners, who will be demoing JavaFX on mobile devices at Mobile World Congress in Barcelona, Spain from February 16-19, 2009. On the OEM side, the partners include Sony Ericsson and LG Electronics. Sprint and Orange are also involved, as well as two ISVs - Cynergy and MobiTV, who will be demoing JavaFX applications on mobile platforms at Mobile World Congress.

"Sony Ericsson is committed to delivering innovative and energized user experiences to our consumers, working closely with partners who share the creativeness and vision.” says Rikko Sakaguchi, corporate vice president and head of creation and development at Sony Ericsson Mobile Communications. “We see JavaFX as a natural fit to our mobile software platform strategy to enable developers, both in-house and in our ecosystem, to create superior, innovative, expressive mobile applications and services. Sony Ericsson expects that JavaFX will have a great impact on the mobile content ecosystem and plan to bring JavaFX to a significant part of our product portfolio.”

Deploy To Your Device Of Choice

There are two JavaFX deployment options available for mobile devices. One, is to have the runtime embedded on the device. The other option is to deliver "over the air". This means you would have your JavaFX application with the runtime bundles into it. Because JavaFX runs over JavaME, it can run on MSA (Mobile Service Architecture) class ME devices. Because of being built on JavaME, companies will be able to leverage their current investment in JavaME.

Of course it will also be possible for you to compile up your JavaFX application into byte code and download onto your mobile device. All those services on the ME stack and your device will be available to your JavaFX application, so you can take advantage of Bluetooth, GPS and any other services on your device. This is another key differentiator between JavaFX and other toolkits - you have as much functionality as you would expect from Java.

Building an Eco-System

It sounds to me that Sun is putting a big effort behind creating an effective eco-system for the JavaFX community. More examples will be available along the way - perhaps we'll see some developer competitions in the future, and it would be nice to have an applications store, equivalent to the iPhone store. There will be more release of the JavaFX Runtime and SDK between now and the end of the year. While JavaFX TV is expected in later 2009/early 2010, we can still expect more releases before that.

Integrating JavaFX To Existing Applications

One of the things that I've been trying to do is integrate JavaFX into existing applications written in Swing and SWT. I've seen how nice JavaFX applications can look, and I want that for my (now clunky!) desktop applications. While there's inofficial workarounds available for getting you JavaFX application onto your Swing JPanel, there still isn't an approved way of doing this. And I haven't found a way to do this for SWT at all. Hopefully this functionality will make a future release (I'd like in in 1.2!).

After talking to the folks at Sun, it is something they are considering, but it seems that the focus was on the RIA customer base (Web and Ajax developers) rather than the traditional Java developer. John Burkley assured me that these things will be possible later. He agrees it's would be great to script up a UI in JavaFX and have the same backend available without the need to completely re-work the UI to JavaFX in one go. I'm looking forward to when I can start making that transition in my Java applications.

It's going to be really interesting to see how JavaFX is received in the mobile community. It's another tough arena to crack, with Android and iPhone applications quite popular. But JavaME has been out there for quite some time. Will it provide the right base for JavaFX to find it's home in mobile devices?


Richard Lowe replied on Thu, 2009/02/12 - 9:58am

Really happy with what I have seen from JavaFX but it all boils down to the VM. If it starts fast and is easy to install Java RIA takes off if not it sinks.

Carl Antaki replied on Thu, 2009/02/12 - 9:22pm

The JVM startup as well as Java Web Start are the problems. Waiting 8s for an app that takes less than 1 second in Flash is unacceptable. Also waiting more than 5s for a movie to load is just non sense.

How could they release a technology that's so poor performance wise. Maybe with version 1.5 due in 6 months it will be better but I doubt it, it will take much more time. It took Swing more 8 years to achieve acceptable performance with Java 6. We may have to wait untill Java 7 and if that's the case then JavaFX will just not cut it.

Karsten Silz replied on Fri, 2009/02/13 - 9:58am

With regards to the "over 80 million downloads of he JavaFX runtime": I believe that since JDK / JRE 1.6u11, JavaFX is bundled with the JDK / JRE, so you get JavaFX no matter whether you use it or not.  Adobe and Microsoft do the same - Adobe bundles AIR with Adobe Reader, Microsoft pushes Silverlight through Windows Update.

The real JavaFX test to me are applications - and I haven't seen anything big out there.  Unlike Microsoft, Sun can probably not afford to "buy apps" (Olympics / inauguration / Netflix streaming). 

The vendor support for JavaFX Mobile was disappointing - where is Nokia and Samsung, both Java ME customers?  And phones with JavaFX will show "in 2009" which could mean they are half a year away.  Compared to the original claims (H1/08 - http://www.theregister.co.uk/2007/05/08/sun_java-fx/), JavaFX Mobile would be more than a year late by then.

Adobe demonstrated Flash Player 10 for Mobile last November (http://www.adobe.com/aboutadobe/pressroom/pressreleases/200811/111708FlashPlatform.html), and I think they want to have that ready this fall, which may mean that Flex 4 would run on mobiles and computers shortly after JavaFX Mobile is in production.  And I believe that as part of the open screen project (http://www.openscreenproject.org/), the Flash Player is free, unlike JavaFX Mobile (at least you used to pay for JavaME on which JavaFX Mobile is based).

Carl Antaki replied on Fri, 2009/02/13 - 11:22am

Completly agree with you Karsten. Sun doesn't have Microsoft's money and marketing power. It's gonna be hard for JavaFX to succeed the only advantage it has is the Java community. The platform is still in 1.1 release so we may have to wait to 1.5 or 2.0 in order to judge it.

Richard Lowe replied on Fri, 2009/02/13 - 11:31am in response to: Carl Antaki

Although I think your point is valid it's a bit of exaggeration. Do you have any real world example to point too? Please don't compare a demo to a production product. I don't think we have enough information to make that judgement.

Karsten Silz replied on Fri, 2009/02/13 - 12:23pm in response to: Carl Antaki

Another problem: JavaFX currently doesn't have a visual UI builder - my guess that will come in Netbeans 7.  But will they add it to Eclipse, too?  There are more things - JavaFX doesn't seem to have the rich charting / graphing components that  Flex has.  Rich charting / graphing components may be a killer reason to rewrite some exisiting Swing business apps (pretty much an oxymoron - there aren't really a lot of consumer Swing apps) - in these times, I doubt many Swing apps are rewritten to add animations.  But even that could be made simpler with some sort of "Swing to JavaFX translator".

Now we have to cut Sun some slack - they try to catch up with Flash (multimedia) and Flex (app UI) at the same time, and it took Adobe / Macromedia ten years to get there.  Then again - Sun blew applets big time the first time around, so they only have themselves to blame.

Guido Amabili replied on Fri, 2009/02/13 - 12:45pm in response to: Karsten Silz

Doesn't jfreechart run in javafx ?

Karsten Silz replied on Sun, 2009/02/15 - 8:35am in response to: Guido Amabili

For charts, I want something like this Flex dashboard:


  • Mouse over the data points to see the data.
  • See how nice the pie chart looks and how the charts are animated when you select a pie piece.
  • See how using the sliders at the top changes the charts.

R. Todd replied on Thu, 2009/03/05 - 5:01pm in response to: Carl Antaki

Many of the posts here show obvious bias to Flash and Flex and ignorance about the Java platform in general. You have to compare apples to apples people.

"Waiting 8s for an app that takes less than 1 second in Flash is unacceptable". I have done real world apples to apples comparisons (solving the same set of GUI req's from the same server/same bandwidth, etc.). My conclusions were that on average, load times for JavaFX on the desktop are around 10-15 percent longer than flash/flex - not 8 orders of magnitude as stated above.

Flash will probably always be a bit faster at pure web-based vector animation, so if that is all you are interested in then stick with Flash. But once you enter the realm of "desktop application like" functionality combined with rich media (including enterprise security requirements), well then the feature set in JavaFX and those directly accessible to JavaFX in the underlying Java Platform far exceeed anything you can do with Flash/Flex. And you can do it with less code (since JavaFX Script language is much more succint than Actionscript)!

So if all you want is simple and "purdy" web animations/multi-media GUI's running in desktop browsers only, then Flash/Flex is your friend. But what if you need full blown enterprise capabilites with all those same "purdy" interface features accessible in everything from desktop applications (inside and outside your browser) to mobile phones and consumer electronics?

From my own in-depth (and unbiased) evaluation JavaFX is much better positioned for this solution domain.

"It took Swing more [than] 8 years to achieve acceptable performance with Java 6." This is an example of ignorance about the java platform. Yes Swing was painfully slow in the early days - and now a properly written Swing GUI perfroms close to native GUI code while remaining portable. This has much more to do with the optimization of the Java VM Runtime than with the optimization of Swing. Optimizing the VM for different platforms takes much longer than optimizing a GUI library running on that VM. And 8 years to optimize a virtual machine that is now capable of performing at or near native code benchmarks (ACROSS PLATFORMS!!) is very quick indeed.

I predict this: JavaFX for the desktop will eventually acheive some penetration into Flash's/Flex's marketshare within the desktop browser space, but it will take quite a while due to entrenchment. In contrast JavaFX Mobile will be adopted quickly, and within the mobile and embedded RIA space JavaFX will reign supreme with marketshare over all contenders. As evidence just look at the list of manufacturers that have already jumped on board (Sony Ericsson, LG, etc.). Also there is already a lot of buzz about getting their hands on JavaFX Mobile for Android, iPhone and LiMo in all their development forums. So the independent developer momentum is growing rapidly for such a new framework.

BTW Karsten: Netbeans 6.5 has a very nice visual UI builder for JavaFX. And there are a couple emerging for Eclipse too. Java ME is (and has always been) free just like JavaFX. Also, Java ME is already on 2.2 billion handsets today (even on many WM devices!). While Flash Mobile/Lite is lucky if it can claim 5% of that marketshare.

Finally everyone may want to check out this video from JavaOne to see where things are going (with particular attention to data instrumentation and built-in codecs). Then you begin to see that JavaFX as a uniform time-based media distribution framework could be very compelling.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.