When to use JavaFX 2 instead of HTML5 for a Rich Internet Application (RIA)?

These days, we are starting a new project for realizing a Rich Internet Application (RIA). One of the first questions is: Which technologies and frameworks shall we use? The backend will be Java or another modern JVM language, as we are mainly experienced Java developer. In most use cases, we also prefer web frameworks, which allow to code mostly in Java, as many of us just have basic knowledge regarding HTML and JavaScript.

A decision has to be made for the upcoming project: Shall we use HTML5 or JavaFX 2 for realizing the web client? If you ask Google for “javafx or html5”, you do not find much information. In the majority of cases, you end up with a presentation hold at several IT conferences in 2011: “Moving to the Client: JavaFX and HTML5 Presentation”. Here is the Slideshare link (from JavaOne 2011): http://www.slideshare.net/steveonjava/moving-to-the-client-javafx-and-html5. Because this presentation does not help much, we took a look at pros and cons, which are listed below in this blog post.

But let’s start from the beginning…

What is a Rich Internet Application (RIA)?

There is no real definition for RIA. Therefore, here is my definition for this blog post:

“A Rich Internet Application provides a modern looking web application with animations, effects and multimedia features. The web application is hardly recognizable as web application. There is no classic HTML user interface with forms, drop down boxes or tables. Typical features of web browsers such as bookmarking or forwards / backwards navigation are usually missing / not required. It is client-centric, i.e. most of the user interface is loaded at the beginning to offer very good responsiveness. Sometimes (i.e. if you use a web framework instead of just HTML5), a plugin must be installed (e.g. Java Runtime Environment or Adobe Flash Player). Pokerstars (www.pokerstars.com) is a very good example for a RIA.”


Several alternatives are available in the JVM environment for realizing a RIA:

  • Plain HTML5: Good solution, but you do not code in Java or another JVM language.
  • Adobe Flash / Flex: Dead! Even Adobe moves to HTML5.
  • Microsoft Silverlight: Dead! Even Microsoft Windows 8 moves to HTML5. (Of course, Silverlight is no real JVM solution, but you can make it work together with JVM backend. For the sake of completeness, I added it to this list.)
  • JavaFX: Java-based solution (replacement for Swing in the future).
  • Other JVM web frameworks besides JavaFX (JSF, GWT*, Wicket, Tapestry, Grails, Lift, “You-Name-It”): Not built for realizing RIAs. Yes, you can realize a RIA with these frameworks. Though, development is ugly, and the RIA will be ugly, too. So why would you do this? (Please remember my above definition of a RIA before you begin complaining in the comments!)


* GWT also has nice (experimental) HTML5 support for some features already: http://www.google.com/events/io/2011/sessions/gwt-html5-a-web-developers-dream.html => If Google continues adding support for HTML5 to GWT, this may be a good alternative in the next years, too – you develop only in Java, and you do NOT need a browser plugin because GWT generates plain HTML and JavaScript. However, there are also rumors that GWT is dying due to Google’s new language Dart. Google did not comment this yet, or release a roadmap for GWT.

So, the question is when to use JavaFX 2 instead of HTML5 for realizing a RIA (from the view of a Java developer)? If you do not know much about HTML5 or JavaFX, you should look at Wikipedia or google for other articles.

What is HTML5?

=> http://en.wikipedia.org/wiki/Html5

Important: HTML5 is HTML + CSS + JavaScript! It offers several next generation features for modern web development, such as Offline Storage or Application Cache.

What is JavaFX?

=> http://en.wikipedia.org/wiki/Javafx

Reminder: We are talking about JavaFX 2.0. The main difference to earlier versions is that JavaFX now offers a Java API instead of a new programming language (JavaFX Script). Thus, it is easy to learn for a Java developer.

Why HTML 5 / JavaScript?


  • W3C standard
  • It’s the future – no question!
  • No plugin is required, can be used in every (supported) web browser
  • Already many widgets and features available


  • Development with HTML / JavaScript instead of Java => Main disadvantage for a Java developer!
  • Spec not final yet (according to the roadmap not before 2014!)
  • Not supported by all browsers (yet)
  • Cross-browser development is necessary (JavaScript frameworks such as jQuery or Dojo solve this problem, but increase efforts nevertheless)

Probably, there are many other pros and cons for HTML5. Though, the named ones should be sufficient for deciding when to use HTML5 or JavaFX.

Why JavaFX 2?


  • Offers a Java API => Leverage your Java skills and use existing JVM features and libraries
  • Offers DSLs for further JVM languages, e.g. Groovy (GroovyFX) and Scala (ScalaFX). Read this article to learn how to benefit by using modern JVM languages instead of Java: “JavaFX 2.0 and Scala, Like Milk and Cookies” => http://www.javacodegeeks.com/2012/02/javafx-20-and-scala-like-milk-and.html
  • optional: “layouting” language FXML to split UI definition from behaviour => choose your favorite between programming (with Java) and layouting (with FXML)
  • Same development environment for backend and web client (including debugging, refactoring, etc.)
  • No cross-browser problems
  • CSS support (as in HTML)
  • HTML and / or JavaScript can be integrated in a JavaFX application
  • Swing and JavaFX can be used in same application, so existing Swing applications can be extended
  • JavaFX 2 provides a unified architecture for writing an application once and then deploying it to various contexts (standalone application, embedded in a web browser or run via Java Web Start). Additional contexts will be added in the future (e.g. running the same application on a mobile device).


  • Java Runtime Environment is required on client
  • Only parts of JavaFX are open source. The Oracle JavaFX runtime and SDK will continue to be released under the Java Binary Code License
  • JavaFX for Mac only available as Developer Preview (GA planned for the mid of 2012) => see JavaFX roadmap
  • JavaFX for Linux not available yet (Developer Preview planned for Q3 of 2012)
  • No information about future of JavaFX Mobile yet (at least I did not find anything, if someone has a link, please add a comment!)
  • Offers less widgets and other features than HTML5
  • Though JavaFX is the (future) replacement for Swing, development is different due to several new concepts. Of course, this is the consequence of adding RIA features such as animations => Thus, this is no real disadvantage, and its still easier for a Java developer to learn some new concepts than learning HTML and JavaScript


HTML5 and JavaFX 2 are both awesome for realizing RIAs including media, charts, animation, etc. In the end, both have a different target audience:

  • Public web applications should be realized with HTML5, because requiring a browser plugin is a no-go in most use cases. Therefore, even for Java developer there is no alternative to HTML5.
  • Within an enterprise, it may be acceptable to require a plugin. Probably, Java is already installed on most machines anyway. If all needed widgets and other features are available, JavaFX is the better choice for enterprise applications because a Java developer can realize RIAs much easier by developing in its well-known JVM environment.

Have fun realizing your RIA with HTML5 or JavaFX 2. By the way: We will probably choose JavaFX for our internal project because the required Java plugin is no show-stopper and most colleagues are Java developer.

If I missed any important pros or cons, or if you have any other feedback, please feel free to leave a comment…


Best regards,

Kai Wähner (Twitter: @KaiWaehner)

Tags: , , , , , , , , , , , , , , , , , ,

18 Responses to “When to use JavaFX 2 instead of HTML5 for a Rich Internet Application (RIA)?”

  1. René Jahn Says:

    Another alternative for RIA is JVx. Take a look. If you use JavaFx maybe JVx is an option too.

    For data centric applications, you save development time and have results in minutes. 

  2. Arne Degenring Says:

    Check out http://www.vaadin.com. It is a Server-side Java web framework that offers a Java-only, component-oriented programming model which is very similar to Swing –> very intuitive for Java and even JavaFX developers. Other than GWT, it is a Server-side web framework.

    Internally, Vaadin uses GWT for rendering the client side UI components. As long as you don’t create your own widgets, you don’t have to deal with GWT or HTML/CSS/JS directly.

    The result from a Client perspective is a HTML5 web app that runs without a client side JRE, but created using a light-weight Java-only programming model, and run by a full server-side Web framework including server-side validations … etc.

    I introduced Vaadin in my current project for a company-internal tool, and everybody likes it a lot.

    To be honest, there’s not too much load on this application – not sure if it would scale up for applications with a high number of concurrent users. Also, there are no very detailed requirements on the UI for this tool other than it should be “good-looking”, “modern” and “user-friendly”.

  3. Kai Wähner Says:

    Hey Arne,
    nice to hear from you…
    I know Vaadin, and I really like it. It’s an awesome server-centric web framework. Though, in my opinion it is no competitor for a RIA. I added some detail to the definition of a RIA above, which I forgot, unfortunately: “It is client-centric, i.e. most of the user interface is loaded at the beginning to offer very good responsiveness.”
    I think Vaadin is an awesome alternative to JSF, Wicket, Tapestry, and other server-centric web frameworks.
    Best regards,

  4. Stardrive Says:

    Salutations from the other side,

    Thanks for raising this important topic and all the pros and cons. I’ve been walking this same path and due to the painfully long time it has taken JavaFX to get its act together I finally started looking around at what the HTML5 phenomena is all about. I can hardly begin to share here what is going on out there in the HTML5 universe, it is literally exploding with abilities and tools.

    My project and strategy is moving forward faster now using a hybrid app strategy for JavaFX, Android and iOS. All of them support Webkit based web views. HTML5 is better than FXML (the real deal) and CSS3 rocks and Javascript has become very powerful over the years. Also, I love the foundation of having true standards and not having my important software held hostage by any one proprietary technology.

    In my new view hybrid apps are the new cross platform vehicle. Alas, JavaFX is stuck on the desktop. I really love this brave new world of HTML5 as I have been taking an honest open look at it. There are many excellent Javascript APIs, just one of them is D3.js which works with a DOM HTML5 and SVG scene graph. Not only does it do graphics that exceed JavaFX it also has the right idea which is expressed in its name which stands for data-driven-documents (or in other words, model driven scenegraphs built with worldwide standards). Once you see what you can do with the new HTML5 stack its unreasonable to just pin all your hopes on JavaFX.

    The truth is out there, hope you find what your looking for!

  5. dan Says:

    Have a look at CaptainCasa http://captaincasa.com/ it’s pure Java and easy to use. We use it for our enterprise application with GlassFish, Java EE6.
    It has a huge amount of GUI Components.
    Demo: http://www.captaincasademo.com/ccdemos/startdemos.html 

  6. offshore outsourcing Says:

    hello there and thank you for your information – I have definitely picked up something new from right here.
    Looking forward for such type of post. Good Going.
    <a href=”http://www.xpertsfromindia.com” title=”offshore outsourcing”>offshore outsourcing</a>

  7. Shan Says:

    I tried javaFX and develped few desktop application, really its awsome feature.
    I am trying to develop a web application with the combination of spring, hybernate and jsp. I do no how to use javaFX in jsp OR Is there any other way to use javaFX in web application.
    Please guide me.

  8. DA Says:

    Hi. Thank you for the great article. I am still learning about all of the different areas of Java including Swing / now JavaFX2.., so this was a great read about RIA’s in either of the 2 choices you mentioned.

    I just had a comment about this part of your post:

    Development with HTML / JavaScript instead of Java => Main disadvantage for a Java developer!  

    I would wager to bet many Java Developers these days are already being asked to work in these environments where html and JavaScript are being used a lot.

    Anyway thanks again! 

  9. John Says:

    if you consider that java 7 was recently a big  security risc and (mabe the situtation will even get worse) I think the biggest risc/con for javaFX is that your enterprise client company
    might decide to completely uninstall java. That’s quite a con.
    Anyway thank you for sharing your evaluation
    (I’m in the currently same situation)


  10. Alex D Says:

    Your definition of “dead” is wrong. A framework is not dead when its development slows or halts. It is dead when clients can’t run it. The best example is Win32 / MFC. How much development has it seen in the last decade? Yet it’s still what all major Windows programs are built on. Flash (and even Silverlight) won’t be dead until browsers stop running them, and that time is not on the horizon.

  11. Mano Says:

    Consider ZK 6.5 framework and Ext JS 4.1.3 for RAI web app developements

  12. dan Says:

    CaptainCasa is currently switching over to JavaFX
    Demo: http://www.captaincasa.com/fxdemos/index.html

  13. dan Says:

    CaptainCasa FX Client – Beta Phase started

  14. dan Says:

    Why, Where, and How JavaFX Makes Sense

  15. Zoom On Says:

    Wow! Can not believe JavaFX is still anywhere on the map these days. HTML5 is speeding forward like a torpedo and the world is happier for it.

  16. Ruud Says:

    You are mentioning that cross browser support is necessary. The only browser that give rise to problems is IE (and CSS3 issues can be dealt with LESS or Sass).

    From version 8 IE has better support for the standards. There comes a time (and this will not take very long), that there will be no issues anymore (actually it isn’t an issue anymore. But we just have to be a little patient, or rigorous: just bad luck if you are using an older version of IE)
      The older versions of IE will disappear, as do jQuery, since we can do the job with the standard API. Yes it’s not Java, but nowadays  we are expected to be polyglot developers. In my case: I’m a front-end developer and I program in javascript,  Java and Groovy. And by the way: wouldn’t it take a long time to learn JavaFX. In that  same time you can also learn Javascript and it’s fun 

  17. install Tub butterfly world pompano Beach Says:

    Just follow the instructions, every person can fix
    these problems. It’s very vital that you get Plumbing Alameda work
    made by a specialist. Do not just ask any plumber to come
    over and do some immediate repairs.

    my homepage :: install Tub butterfly world pompano Beach

  18. Boca Raton CPAt test review Says:

    Then visit this endorsed web-page and discover how Accountant
    Burnsville can benefit you. The beginning is rather simple:
    accept that you cannot do everything for your business.
    Accounting software should contain common features such as accounts receivable, accounts payable, banking,
    payroll, inventory control, time costing, job costing,
    fixed assets and conversions and updates and more.

    Here is my web-site; Boca Raton CPAt test review

Leave a Reply

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

What is 14 + 9 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)