Yesterday I tried to write my first JavaFX... I Found it quite easy.... It's name was "VideoPlayer".

But when I tried to put it on a web page and deploy it as an java Applet it became a Nightmare !

First I tried to use the code Netbeans give me in my 'dist' folder... It worked well on my computer but not when I putted it on my web site...

I notice then that it was trying to load the JNLP from this host: "http://localhost:8093/servlet/org.netbeans.modules.javafx.project.JnlpDownloadServlet/"... It was the problem !

So I change my "VideoPlayer_browser.jnlp" and change the host by the one of my webSite : "http://www.lexique-du-net.com/javafx/videoPlayer/". It then look like this :

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://www.lexique-du-net.com/javafx/videoPlayer/" href="VideoPlayer_browser.jnlp">
    <information>
        <title>VideoPlayer</title>
        <vendor>Jonathan ANTOINE</vendor>
        <homepage href="http://www.lexique-du-net.com/javafx/videoPlayer/"/>
        <description>VideoPlayer</description>
        <offline-allowed/>
        <shortcut>
            <desktop/>
        </shortcut>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.5+"/>
        <extension name="JavaFX Runtime" href="http://dl.javafx.com/javafx-rt.jnlp"/>
        <jar href="VideoPlayer.jar" main="true"/>
    </resources>
    <applet-desc name="VideoPlayer" main-class="com.sun.javafx.runtime.adapter.Applet" width="384" height="288">
        <param name="MainJavaFXScript" value="videoplayer.Main">
    </applet-desc>
</jnlp>

It then worked well !

I also give you what to put in your HTML page :

javafx(
        {
              archive: "VideoPlayer.jar",
              draggable: true,
              width: 384,
              height: 306,
              code: "fr.antoinej.videoplayer.Main",
              name: "VideoPlayer"
        },
        {
	      isApplet: true
	 }
    );

I some params (isApplet: true) to tell my apps that it is an applet....

An other interesting thing you can add on you HTML page is to add thie next snippet in the header part. It will reload you JNLP files and do not use the cache each time you will load the page... Better when adding frequently features to you application...

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

Update (21/12/2008): You can now find a tutorials on the JavaFx webSite : here !

+++