JavaFX – can it really be deployed in a browser? [closed]

Update for the March 2018 Java Client Roadmap

I encourage readers interested in this question to review the following Oracle Whitepaper:

The above paper outlines the official Oracle position on related technologies (JavaFX/Swing/AWT/Applets/WebStart), the dates until which it intends to support those technologies and which of those technologies it intends to transition to open source development projects separate from the JDK and JRE.

Update for Java 9, Oct 2017

According to the Java 9 release notes:

Java Applet and WebStart functionality, including the Applet API, The Java plug-in, the Java Applet Viewer, JNLP and Java Web Start including the javaws tool are all deprecated in JDK 9 and will be removed in a future release.

So, for Java 9+, deployment of JavaFX in a browser using a Java plug-in will only be possible using deprecated technology. Oracle notes in another part of the Java 9 release notes:

Deprecates the Java Plug-in and associated applet technologies in Oracle’s JDK 9 builds. While still available in JDK 9, these technologies will be considered for removal from the Oracle JDK and JRE in a future release. Applets and JavaFX applications embedded in a web page require the Java Plug-in to run. Consider rewriting these types of applications as Java Web Start or self-contained applications.

Note: Java Web Start isn’t really an alternative as that is also deprecated (anyway, it’s different from an application embedded and rendered within a browser page). Also note for those who wish to use Web Start, even though it has now been removed from Oracle JDK 11+, it is available as open source, info on this is at OpenWebStart.

As an alternative which offers similar functionality, consider something like jpro, which deploys JavaFX applications in a browser without a Java plugin (jpro is currently only in closed beta, so it is not a viable solution as of October 2017, but maybe someday in the future…).

For now, I would recommend that the best way to deploy JavaFX applications is as self-contained applications, running outside a browser.


Previous answer for Java 7 and 8

JavaFx – can it really be deployed in a browser?

Yes, JavaFX applications can be deployed so that they run inside a web browser hosted html web page.

The technology which allows this to occur is the Java Plugin. This plugin is currently a NPAPI based browser plugin solution. The Java Plugin is shipped with the Oracle Java 7 Runtime Standard Environment.

Not all browsers are supported, only those listed on the JavaFX Supported Configurations page.

How easy is it to deploy via web browser?

The easiest way to deploy a JavaFX project in a web browser is:

  1. Create a new JavaFX project in NetBeans.
  2. Develop a simple HelloWorld App.
  3. Follow the instructions for Deploying your first JavaFX Application.

This is not difficult (in my opinion).

Alternatively, follow instructions on the detailed reference for Deploying JavaFX Applications (or use 3rd party tools). For many projects, using a tool other than the NetBeans IDE to perform packaging is a better approach. However, it is generally easier to let the NetBeans IDE handle deployment packaging tasks for you.


What follows is not related to answering the original question, but provides some opinions and information requested in comments on this answer.

Some Advice

There are pitfalls to deploying Java in a browser. I encourage you to do your own Google research on the subject.

In my mind, based upon the current JavaFX 2.x deployment model, for most application types that require a browser as the primary runtime container, using JavaFX is not an appropriate solution.

Examine the deployment and runtime requirements for your application. Based on your requirements, and knowledge of the JavaFX browser based execution model, decide if a browser based deployment using JavaFX technology is the correct mechanism for your application.

A couple of potential difficulties for browser embedded JavaFX applications

Some important browsers (e.g. Internet Explorer 10, iOS Safari and soon Desktop Chrome) don’t permit execution of plugins using the NPAPI currently used by the Java browser plugin => some of your target users may be unable to use your application.

With a browser embedded application, you don’t have complete control over the runtime on which your application executes (browser + Java runtime + plugin interface) => an application which was working when first installed may stop functioning as expected after an update to these runtime components.

Deployment Alternatives

If a browser based deployment model is not appropriate for your application, there are other ways to deploy JavaFX applications (e.g. WebStart, stand-alone jars and self-contained applications).

Leave a Comment