Java 6 Webstart cache
We have an application developed on Java 5. It is downloaded and run via Web Start. After the application is downloaded, the main class scans for JARs that contain a special manifest file to determine the plug-ins to load.
Using Java 5 the application is nicely cached on the filesystem and we can walk through the directory structure that is as we defined it.
Now we want to upgrade to Java 6. But in the new Web Start caching the JARs aren't stored any more as is in the their correct structure.
Any idea how to resolve this?
[554 byte] By [
NickDGa] at [2007-11-26 23:58:01]

# 1
..
> Any idea how to resolve this?
Run a tool at build time that identifies both the
jars and classes of interest. Add the jars to the
resources section of the JNLP file, and write the
class list to a file. Include the class list file in
the main application jar, read it at run-time to
identify the classes, then use getResource() to
locate them.
Note that Sun makes no guarantees about the
location of the Web Start cache, and it is generally
considered bad design to do anything that relies
on knowing where the classes are actually
located of the file system.
# 2
You can download the Java 6 source code and examine the algorithm for locating the Jar files. I've done it, it is something like a hash on the name and version or something. Obviously it's not a great idea to rely on where the files are downloaded, but there can be good reasons.
# 3
> Obviously it's not a great idea to rely on where the
> files are downloaded, ..
Strongly agree.
>..but there can be good reasons.
Like what? (Barring - if you need the classes
to reside in a specific place*, put them in
a specific place - like a subdir of user home.)
* One example of the latter is offering the end
user a place to drop archives that contain
classes intended as plug-ins for the
application. The application needs to know
where to look for the new classes, and the
end user also needs to know where the location
is, so they can easily add new plug-ins.