This content has been marked as final. Show 4 replies
I have the same question: I managed to get my first JavaFx 2.0 application working as standalone application, started from the jar file.
As next step, I would like to get it working within a browser. I found the description in http://docs.oracle.com/javafx/2.0/deployment/deployment_toolkit.htm#BABJHEJA, but I don´t understand what to do. Besides that, the syntax in that article (with "var app = ..." and "id: ...") looks like JavaFx 1.3. Does it really describe a JavaFx 2.0 application?
If so, as I understood, the application should be started by loading a HTML file, which contains the deployIt function within a script tag in example 5-3, but what values are to be entered?
I assume, for placeholder I have to enter the same value as in the div tag in the HTML body; and the value of the attribute id ("myApp" in the example) is probably the name of the application main class, right?
Besides that, the url parameter is to be specified. It is described as the location of the JNLP file. That means I need a JNLP file to start my JavaFx application in a browser. Ok, I can refer the file if it exists. But how do I generate it?
Thanks in advance for detailed help.
Tweaking using deployment toolkit is advanced use.
How do you build and package your application?
The key is to follow packaging guidelines. It is one package that can be run in the browser and standalone (package consists of several files).
Start with getting started section (http://docs.oracle.com/javafx/2.0/deployment/deploy_quick_start.htm#BABJCFHC) and use javafxpackager (or better ant task) to package app.
But easiest way would be install Netbeans 7.1 and use JavaFX project there. It will use ant task behind the scene to generate all package files.
thanks for the hint to use NetBeans 7.1. I installed that version; it builds the jar file which can be started as standalone application.
It also builds a HTML file and a JNLP file in the dist directory, but via these files I don´t get the application started. Maybe my way of starting is the wrong way; what I do is this:
I load the HTML file into a browser (I tried Internet Explorer and Firefox, both with same result); the HTML content is shown: A header line and a "Launch" button. Clicking the button invokes a confirm dialog to start launch.jnlp, but the launch is aborted with exception:
com.sun.deploy.net.FailedDownloadException: Ressource could not be loaded: file:/E:/GerhardsDaten/JavaFx_Projects/SokoTown/dist/$$codebase/launch.jnlp
The correct file path is without /$$codebase. I assume I have to change any detail in the project properties in NetBeans, but I have no idea.
Besides that, starting via JNLP would one nice feature; what I was asking for in this thread was running the application within the browser. JavaFx documentation describes that a JavaFx application is startable in three ways: 1. as standalone application, by doubleclick on the jar file (that is working in my case), 2. running within a browser, 3. via JNLP.
JNLP will start the application in a separate window, once it is successful. I assume, running within a browser would look similar to a web site with JSF components; I expect, for this feature I would need another HTML file with some JavaFx specific tag and to load that file into the browser, so that the tag loads the application. Am I right? If so, how can I convince NetBeans to generate that HTML file (or what ever I need) also?