Home » Java » Desktop Java » JavaFX 2 vs. HTML5 for RIA

About Kai Waehner

Kai Waehner
Kai Waehner works as consultant. His main area of expertise lies within the fields of Java EE, SOA, Cloud Computing, BPM, Big Data, and Enterprise Architecture Management. He is speaker at international IT conferences such as JavaOne, ApacheCon or OOP, writes articles for professional journals, and shares his experiences with new technologies on his blog.

JavaFX 2 vs. HTML5 for 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. 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.

Reference: When to use JavaFX 2 instead of HTML5 for a Rich Internet Application (RIA)? from our JCG partner Kai Wahner at the Blog about Java EE / SOA / Cloud Computing blog.

(0 rating, 0 votes)
You need to be a registered member to rate this.
10 Comments Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments
9 years ago

You should take a look at Vaadin, too. Vaadin is a Webframework based on GWT with a server centric approach which is optimized for developing RIAs.

9 years ago

I am also a Java programmer who is moving now to javascript and HTML5 programming. I feel the less layers between me and the end user, the better things will be. Installation of Java on clients machine is becoming more confusing, and JavaFX installation adds more confusion. I feel HTML5 and Javascripts are just simpler for the end user to use. Less hassle. No plugins, no jre’s to install, no class path to define, and all these problems that come with Java. And as performance of HTML/Javascript improves with time,  I see no reason any more to use Java to… Read more »

Srikanth S Nair
9 years ago

Until Java is in the hands of Oracle nothing will workout for Java FX… HTML5, CSS 3 and other Javascript libraries are widely accepted and people started using it. At the end of 2014 or early 2015   HTML will change the http://WWW. 
Let Open Java run behind and HTML do the wonder :)

8 years ago

you don’t know what you are talking about. You can’t create serious desktop app with html5.

Chris Emery
9 years ago

I must admit a preference to a fully dynamic 3D style interface
(~Svg+SMIL) with a UML backend (Eclipse). I wish there was a better 3D
designer that could link to UML (jpython).

8 years ago


8 years ago

JavaFX on mobile? This is UI framework for creating PRODUCTIVITY applications. They focus on enterprise, professional usage, especially desktop, not point & touch mobile fart apps.

8 years ago

m a experienced Javascript,jquery and html5 developer.. all this hype about HTML5 is nothing.. u cannot create performance oriented enterprise applications… as per my experience enterprise application development possible only with JavaFx and Flex…. HTML5 is no contention to this frameworks.. and it consumes lot of development time..as compared to Objected oriented frameworks like flex and javafx.

Java Training In Chennai

Very useful article

Anthony Pace
Anthony Pace
8 years ago

I hate how idiots say flash is dead… dude… it is still everywhere, and on the PC, especially for older systems that crash when you try to run a site using canvas or webgl, Flash is the perfect choice. Think about the millions of people in poor countries and about students stuck using old systems that won’t be able to use your app in the browser unless it is written in AS3… Also think about the fact that, given the beautiful Flash CS6 IDE, the development time for beautiful apps, is almost nil when compared to developing for Java. JavaFX… Read more »