Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java web start and jars...

4 views
Skip to first unread message

tiewknvc9

unread,
Sep 21, 2006, 5:10:07 PM9/21/06
to
I have a couple of questions about this, and Im hoping a couple of you
can share your thoughts.

With java web start, if I were to pack everything into a single jar and
have someone download it. Then update a single class file within that
jar, is the whole jar downloaded onto their computer for the next
update? Or is the single class file downloaded to their machine for
the update?

If the answer is that the entire jar file is downloaded... then....

can java webstart support multiple jar files as a single application?
meaning, if I were to supply 3 jar files (one with the graphics, one
with library jars/zips, and one with my classes), how would I go about
loading the resources from the seperated out jars? Or would it seem
seemless as long as the classpath is set up properly?

Thomas Hawtin

unread,
Sep 21, 2006, 5:46:45 PM9/21/06
to
tiewknvc9 wrote:
>
> With java web start, if I were to pack everything into a single jar and
> have someone download it. Then update a single class file within that
> jar, is the whole jar downloaded onto their computer for the next
> update? Or is the single class file downloaded to their machine for
> the update?

If you just dump it on a web server, then yes. However, there is a
jardiff format for patches. IIRC, there's a provided servlet that
handles the serving up the right version.

> can java webstart support multiple jar files as a single application?
> meaning, if I were to supply 3 jar files (one with the graphics, one
> with library jars/zips, and one with my classes), how would I go about
> loading the resources from the seperated out jars? Or would it seem
> seemless as long as the classpath is set up properly?

Yes. All the classes from all the application jars are loaded by the
same class loader.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/

Thufir

unread,
Sep 21, 2006, 9:20:44 PM9/21/06
to

What do you mean by "everything"? For instance, if the app uses a third
party jar file, which you distribute, then it's already a minimum of two
jar files which JWS is distributing.


-Thufir

Andrew Thompson

unread,
Sep 21, 2006, 10:08:03 PM9/21/06
to
tiewknvc9 wrote:

Thomas seems to have answered the core of your technical
question, but I will just point out that..

> ...if I were to supply 3 jar files (one with the graphics, one
> with library jars/zips, ..

..if you have (for example) ftp.jar, format.jar and properties.zip,
*each* of these will need to be added separately to the application's
classpath.

If you bundle *those* three files up in an 'alllibs.jar', the
classloader will fail to find resources in any of the three
libraries. Java classloaders are not set up to deal with
'archives within archives'.

Alternately, you might
a) extract the contents of each archive and put the entire
result into a single archive (a very non-optimal approach), or..
b) reference each of the library files in a single JNLP file
that is marked as an extension/component, then have other
JNLP files refer to the extension JNLP.

Option b) is the best because it allows you to refer to
the resources ..
- 'on mass', where needed, via the extension JNLP
- separately, in the case where less than the entire
set is required.
- in other JNLP's (both extension and application/applet).

HTH

Andrew T.

Nicolas Moreau

unread,
Sep 22, 2006, 4:35:00 AM9/22/06
to
Andrew Thompson a écrit :

>> ...if I were to supply 3 jar files (one with the graphics, one
>> with library jars/zips, ..
>

> Alternately, you might
> a) extract the contents of each archive and put the entire
> result into a single archive (a very non-optimal approach), or..


You can use Fat JAR eclipse extension :
http://fjep.sourceforge.net/


--
Nicolas Moreau

Thomas Weidenfeller

unread,
Sep 22, 2006, 4:47:31 AM9/22/06
to
tiewknvc9 wrote:
> With java web start, if I were to pack everything into a single jar and
> have someone download it.

Which is not a clever idea, particular if you start to repack 3rd party
jars (and it might even violate the 3rd party licenses). Packing
everything in one big jar is typically only attempted by people who
don't want to use web start and don't get their classpath settings
right in the main jar.

But that's not the issue here.

> Then update a single class file within that
> jar, is the whole jar downloaded onto their computer for the next
> update?

Webstart has a barely documented only-send-the-differences feature:
jardiff files. Your best bet is to use Sun's JnlpDownloadServlet on the
server to generate and provide them, since

http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html

is the only official mentioning of jardiff in the JDK documentations I
am aware of.

Interestingly Sun delivers the source code of a stand-alone tool for
creating and applying jardiffs with each JDK (as part of the mentioned
servlet source code), but doesn't lose a word about it. Go into your JDK
installation directory and then:

./sample/jnlp/servlet/ for a prebuild version:

java -jar jardiff.jar
JarDiff: [-nonminimal (for backward compatibility with 1.0.1/1.0]
[-creatediff | -applydiff] [-output file] old.jar new.jar

And

./sample/jnlp/servlet/src/classes/jnlp/sample/jardiff/

for the sourcecode.

The tool can not only create the diffs, but also apply (patch) an
existing jar.


/Thomas
--
The comp.lang.java.gui FAQ:
http://gd.tuwien.ac.at/faqs/faqs-hierarchy/comp/comp.lang.java.gui/
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Thufir

unread,
Sep 23, 2006, 4:10:33 AM9/23/06
to


Interesting, thanks for the link. Is it just on my end, or is the
threading for this topic wonky?


-Thufir

Andrew Thompson

unread,
Sep 23, 2006, 4:29:35 AM9/23/06
to

It seems logical, viewing through GG*, e.g.
<http://groups.google.com/group/comp.lang.java.programmer/msg/261eae38ae8e3bc9>

* 'Google Groups' - the archive of the group as represented
by the big G..

Andrew T.

Thufir

unread,
Sep 23, 2006, 3:01:42 PM9/23/06
to


Perhaps it's on my end, then. I'm using leafnode and pan. However, I'm
only aware of a single thread, this one, being fragmented. Off topic,
anyhow.


-Thufir

0 new messages