Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Java web start and jars...

Thread view: 
tiewknvc9 - 21 Sep 2006 22:10 GMT
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 - 21 Sep 2006 22:46 GMT
> 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
Signature

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

Thufir - 22 Sep 2006 02:20 GMT
> I have a couple of questions about this, and Im hoping a couple of you
> can share your thoughts.
[quoted text clipped - 12 lines]
> loading the resources from the seperated out jars?  Or would it seem
> seemless as long as the classpath is set up properly?

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 - 22 Sep 2006 03:08 GMT
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 - 22 Sep 2006 09:35 GMT
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/

Signature

Nicolas Moreau

Thufir - 23 Sep 2006 09:10 GMT
> Andrew Thompson a écrit :
>
[quoted text clipped - 7 lines]
> You can use Fat JAR eclipse extension :
> http://fjep.sourceforge.net/

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

-Thufir
Andrew Thompson - 23 Sep 2006 09:29 GMT
> > Andrew Thompson a écrit :
> >
[quoted text clipped - 10 lines]
> Interesting, thanks for the link.  Is it just on my end, or is the
> threading for this topic wonky?

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 - 23 Sep 2006 20:01 GMT
>> > Andrew Thompson a écrit :
>> >
[quoted text clipped - 18 lines]
>
> Andrew T.

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
Thomas Weidenfeller - 22 Sep 2006 09:47 GMT
> 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/downloadservlet
guide.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
Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.