问题
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:
Can anybody help me to convert this JavaFX project to run on a browser?
回答1:
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)
来源:https://stackoverflow.com/questions/39229508/convert-javafx-desktop-app-to-web-app