Classpaths and JNLP (third attempt at post?)
Hi,
I have searched the forum for an answer to this questions, but have yet to find one. I have the following resources section of a .JNLP file:
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="program.jar/>
</resources>
... and I have this program deployed to several clients. I have just found out I need to deploy a patch. The patch should override one of the classes already in program.jar. In straight java, I would include a new file (patch.jar) and put it before program.jar in my classpath. I cannot do this with webstart, however, because if I put patch.jar before program.jar, it looks for my main() in the patch.jar and it get an error.
Am I missing something here? I could put a main() in patch.jar and then invoke the main() class in program.jar directly... but that seems klunky. I figure webstart must have a way of doing this... right?
Thanks for any help you can offer.">
[1016 byte] By [
houckmana] at [2007-11-26 16:08:47]

# 1
The normal way to update a web-start applications would
be to update the program.jar. The web-start client
should check for and detect the new file date, and download
the new jar.
A couple of notes.
- This can be optimised in a number of ways,
the simplest of which is to 'carve up' the jar
into a number of smaller jars (perhaps by
package). This way, any patch will ultimately
lead to a smaller upload (on your part)/download.
- Updating (as well as web start in general) works
much better with valid JNLP files, while that small
snippet of XML you posted, is not valid.
This may highlight the difference..
Your original snippet.
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="program.jar/>
</resources>
My version..<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="program.jar"/>
</resources>
# 2
Thanks... the error I had was just a copy/paste/edit error for the example.
Regarding the original issue, I am planning a rearchetecture to do what you refer to (breaking up the .jar to smaller components).
Unfortunatly, that does not help me in the immediate term. Anyway to actually accomplish the topic of my original question (add a new .jar file to the beginning of the list, but still have the main() in the second file)?
# 3
> ..the error I had was just a copy/paste/edit error for the example.
I advise people to copy/paste directly from their
source files/input/output. It is hard enough to
debug things remotely, without trying to do it
with something that is "not the real code".
Please take extra care in future.
> ...Anyway to actually accomplish the topic of
> my original question (add a new .jar file to the
> beginning of the list, but still have the main()
> in the second file)?
This is not something I have ever tried to do,
but this might work..
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href='patch.jar' />
<jar href="program.jar" main='true' />
</resources>
I have attempted to highlight the changes
by enclosing the attributes in single quotes.
They should be colored blue.
# 4
> Unfortunatly, that does not help me in the immediate
> term. Anyway to actually accomplish the topic of my
> original question (add a new .jar file to the
> beginning of the list, but still have the main() in
> the second file)?
This won't work, because the jar specified with the main attribute would be loaded first, regardless of of the order in the jnlp file.
I suggest just posting updated program.jar untill you can break it up into seperatly updateable jars, or implement a servlet implementing jardiff , to allow downloading only the changed resources.
/Andy