Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to avoid double-download of JNLP download=lazy jars

jlanawaltFeb 11 2011 — edited Mar 16 2011
I am practicing with the lazy setting of the download attribute of the jar element to see if it is a good fit for a large jar that isn't needed when the application is first run. My test app is a simple Swing GUI with a frame, panel and a button. When I click the button I invoke Class.forName and that prompts JWS to pull down the jar containing the class.

Everything seems great on the first run. Only the main jar and the jnlp file are initially downloaded. The large jar is downloaded when Class.forName is invoked. Additional invocations during that run do not download anything. Subsequent runs seem OK too, the jnlp and two jar files are checked for freshness and the server returns HTTP 304 - not modified.

If I update the large jar, or even simulate updating it by using the unix touch command to update it's timestamp, and then launch the jws application again, things do not seem right. At launch the jnlp, main and large jar are checked for freshness. The web server returns HTTP status 304 for the first two (jnlp and main jar) and HTTP status 200 along with the large jar contents. When I invoke Class.forName the first time the large jar is again downloaded. I have verified this using the server logs and Wireshark, network protocol analyzer.

I would prefer that the large jar not even be checked until the first Class.forName run and especially that it is only downloaded once, especially as I consider using download=lazy for potentially larger resource jars.

Am I doing something wrong? How can I avoid this double-download of lazy jars when they are updated?

--
Jacob

Edited by: 836060 on Feb 15, 2011 3:58 PM - switched library for large everywhere for consistency.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2011
Added on Feb 11 2011
9 comments
2,259 views