Ambuoroko
Ambuoroko

Reputation: 342

Java Web Start Jar Access

Is it possible to access the client-side cached jar file from within a Java Web Start application?

Our application auto-populates its GUI by reading through the deployment jar looking for classes that subclass various things, then putting options in the appropriate spot in the GUI. We are trying to use Java Web Start to deploy the application and have traditionally used:

MainClass.class.getProtectionDomain().getCodeSource().getLocation()

to find the jar, then used ZipInputStream entries to find files that end in .class. When the application is deployed from Web Start, though, this location is on the remote server. Since the jar is something like 80 megs, this results in very long loading times (up to 30 minutes) for the application.

Is there some way to find the local copy of the jar file, or some better alternative?

Upvotes: 1

Views: 510

Answers (3)

Andrew Thompson
Andrew Thompson

Reputation: 168845

..better alternative?

It would seem you built the 80 meg. Jar that is supplied. At build time, compile a list of classes and include that list in a known path/name within the Jar (e.g. /resources/plugin-list.txt). Read that file at run-time and you have your list.


Given the size of the single Jar, I would recommend breaking it up into separate Jars by package. That way, if only classes from 2 (out of 10) packages change, only two archives will be automatically updated by JWS.

Upvotes: 1

antlersoft
antlersoft

Reputation: 14751

Use annotations on the classes you want to recognize at run-time instead of searching the jar.

Upvotes: 1

OKeez
OKeez

Reputation: 108

What I do with large JAWS projects (I have one of about 35 MB here) is to create a small launcher JAWS that pulls in the actual project into a local (user) folder.

If your project consists of multiple files then you may need to build a release.xml file or something, so that you can process all necessary files (and folders).

TIP: If you add file size and checksum to the XML info, this allows detecting updates and just downloading the changed files.

Once your distribution has been downloaded/updated, start a Process() calling

java -jar downloadedAppMainJar.jar

Upvotes: 0

Related Questions