Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run JavaFx Application in browser using Eclipse IDE

I am new to JavaFx. I found every tutorials are using NetBeans IDE for JavaFx. But I am using Eclipse. I have learnt and developed many Standalone javafx application in Eclipse but now I want to develop JavaFx Application that runs on browser (same as applet). I have searched but found all material with NetBeans IDE only and not with eclipse. NetBeans generate jnlp, jar and html file by itself as we opt for Run in Browser option in Project Properties. What should I do in case of Eclipse IDE? I am using e(fx)clipse plugin for Javafx in eclipse. Please provide some source for this as soon as possible

like image 748
tarkikshah Avatar asked May 09 '14 10:05

tarkikshah


1 Answers

Have a look at the first tutorial on the e(fx)clipse tutorials page.

To deploy a JavaFX application using e(fx)clipse, the easiest way is to open the "build.fxbuild" file that is created in your project. Enter the required information for the application, then go to the "Deploy" tab (the tabs are at the bottom).

This will bring up a wizard for configuring the applet. The required fields are a width and height for the applet and a "ref" and "id" for the placeholder in the html where the applet will be inserted. (I'm not entirely clear what the "ref" is used for: the "id" is used as an id attribute in the relevant <div>.)

Screenshot of "Deploy" tab in e(fx)clipse build.fxbuild wizard

Enter the required values (and others as needed). Return to the "Overview" tab, and click on the "generate ant build.xml and run". This will compile an ant build file and execute it. You will now find a "build" folder in your project with a "deploy" subfolder. In there, you'll find the files required for an applet: the html, jnlp, jar, and a libs folder with any external jars your application requires.

To understand the options in the build wizard, you will need to understand the JavaFX packaging and deployment process. I suggest reading the tutorial, if you haven't already done so.

The wizard works pretty well; though sometimes I find I need to edit the build.xml and/or the generated jnlp file a little to get things to work. This is most likely because my configuration is not correct from the outset.

like image 189
James_D Avatar answered Sep 19 '22 00:09

James_D