I have a preloader for my application that handles the Application-specific initialization. Now I\'m trying to extend this so that the preloader also shows the p
I have been fighting with this too, recently. I switched back to the (ugly) default preloader (as that one shows up nicely) until I find some more time to investigate this.
If you enable Java Webstart full tracing
"<JAVA_HOME>\bin\javaws.exe" -userConfig deployment.trace true
"<JAVA_HOME>\bin\javaws.exe" -userConfig deployment.trace.level all
you should see preloader messages which should give you some information about what is going on. In my case I could see a lot of messages like these
preloader: Added pending event 2: DownloadEvent[type=load,loaded=0, total=62791, percent=0]
indicating that the custom preloader hasn't been verified/started yet but download events were already coming in.
What happens if you switch <update check="background"/>
to <update check="always"/>
?
This is my test JNLP. Seems like you're missing to specify the JavaFX runtime resource?
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" xmlns:jfx="http://javafx.com" codebase="http://localhost:8080/HelloWorldFX" href="HelloWorldFX.jnlp">
<information>
<title>HelloWorldFX</title>
<vendor>Unknown</vendor>
<description>HelloWorldFX</description>
<offline-allowed/>
</information>
<resources os="Windows">
<jfx:javafx-runtime version="8.0+"/>
</resources>
<resources>
<j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="HelloWorldPreloader.jar" size="10774" download="progress" />
<jar href="HelloWorldFX.jar" size="248884114" download="eager" main="true" />
</resources>
<jfx:javafx-desc width="600" height="400" main-class="sample.Main" name="HelloWorldFX" preloader-class="HelloWorldPreloader"/>
<update check="always"/>
</jnlp>
Note: I haven't tested or executed the code; my answer is primarily based on looking at the code. I haven't worked on JavaFX but I can grasp the code since I've worked on Swing and JNLP before.
The first thing I notice, is that in Phase 2, the default JavaFX preloader handling the downloading of the application JARs is not showing.
This seems to be because of the PreloaderFX.start(stage)
method. The stage
passed as the method's argument remains empty because the method constructs a new Stage()
and adds children to it. If you add the child elements to the method's argument, it should display your custom preloader/progressbar during phase 2.
If the code still doesn't work as expected after this, I'd try debugging all the logic/code associated with the noLoadingProgress
flag. Try commenting all that out (essentially taking noLoadingProgress
out of the picture) and see if it fixes the issue.
Also, even though you've got this right in your code, see this answer - according to which all ProgressNotification
s are handled by the handleApplicationNotification
method.
Hope this helps!