Re: Lazy JAR downloading with JNLP-powered applet
On Aug 11, 2:36 pm, "Qu0ll" <Qu0llSixF...@gmail.com> wrote:
I have not deployed an applet using JNLP before and I have a couple of
questions about lazy JAR downloading in this scenario.
1. It seems I should be able to use DownloadService to download JARs when=
I
want them but I am curious to know how and when the JARs would be downloa=
ded
otherwise.
*Typically* when the class is first referenced.
Having said that, there are exceptions.
- Natives. They are required eagerly. I am not sure
if the DownloadService can add them to the classpath
the first time you go to use them, I have not tried it,
but Sun's general advice is 'eager'.
- Jar's containing SPI classes. E.G. extra codecs for
Java Sound. Either the Jar is downloaded eagerly, or
you need to take 'active control' of the download via
the DownLoadService.
This 'when first referenced' strategy can trip up many
developers that are attempting to launch Jars lazily,
since they will often instantiate the classes of the
lazy Jars, eagerly. This overrides the 'lazy' declaration
and the entire app. is downloaded before appearing on-screen.
..If I specify say 5 JARs in the JNLP file, is it necessary to
explicitly use DownloadService to download them or will they all be
downloaded when they are required ..
Barring the caveats above for things like SPIs and
natives, yes. Although..
..or perhaps when the applet is launched?
...that is how it ends up, for many.
2. And, depending on the answer to (1), does the same apply to extensions=
?
Basically yes. (I cannot think of any situations
where the behaviour would be different).
I have a page devoted to examples of using the
DownLoadService, but note that I was trying with
my own dialog, and it never worked completely right
<http://pscode.org/jws/cache/>
Example 8 is just broken, it does not launch.
Example 7 still had some quirks, but launches OK
and shows 2 of the 3 images (the 3rd is missing).
I must revisit & fix those examples sometime, but
I am too caught up at the moment with Java Sound
based projects.
--
Andrew T.
pscode.org