0

I have a Maven JavaFX based desktop App and I have to convert it to a dynamic web app in eclipse or any other IDE ( I am using Eclipse Neon-Java EE). I have tried with Project Facets (Right click on project name --> Properties --> Project Facets --> dynamic web app) I have generated Web Content files (Meta-INF and WEB-INF). In the project folder still appears the letter "M" and not the golobe icon. When I try to run it in Tomcat it shows a 404 error.

My project looks like this:

Project Image

Can anybody help me to convert this JavaFX project to run on a browser?

Community
  • 1
  • 1
Tim
  • 47
  • 2
  • 8
  • Are you wanting to run this as an applet? I would strongly advise against doing that, in general. – James_D Aug 30 '16 at 17:08
  • @James_D, why the strong advice? – davidrmcharles Aug 30 '16 at 20:18
  • 2
    Getting applets to work with the security imposed by modern browsers is extremely difficult. Unless you can very carefully control the browser environment (e.g. it's an internal application within your company, and the company configures the browser deployment on their machines - at which point you may as well just deploy the desktop app) you will end up trying to support a product in an environment that you can't control and which is highly sensitive to that environment. There are additional technical issues, e.g. running in 32-bit browsers, etc. It's just easier to create a native bundle. – James_D Aug 30 '16 at 20:35
  • 1
    @DavidCharles See also http://openjdk.java.net/jeps/289 – James_D Sep 02 '16 at 02:06

2 Answers2

5

you can not simply run a JavaFX application in a browser. Using a Desktop UI Toolkit (like JavaFX) and a web based toolkit (HTML) are 2 completely different technologies.

To be true there are some frameworks that let you run JavaFX views in a browser ( see example here: http://dlsc.com/2015/12/01/cool-javafx-in-the-browser/) but this is not supported.

If you want to have a web application it would be good to reimplement the views by using a modern web framework like Polymer (https://www.polymer-project.org/1.0/), AngularJS (https://angularjs.org) or ReactJS (https://facebook.github.io/react/).

If you do not want to learn JavaScript you should have a look at GWT (http://www.gwtproject.org), Vaadin (https://vaadin.com/home) or Dolphin Platform (https://github.com/canoo/dolphin-platform)

Hendrik Ebbers
  • 2,570
  • 19
  • 34
0

You can use WebFX to convert JavaFX app to a web app.

niutech
  • 28,923
  • 15
  • 96
  • 106