Re: How to update a jar file for one source file change?




NickName wrote:
Steve W. Jackson wrote:
In article <1164749276.472816.155480@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"NickName" <dadada@xxxxxxxx> wrote:

OP omitted.

I'm not sure if I correctly understand your question...but I *think*
you're asking how to update an existing jar file to replace some parts
and perhaps add new ones.
Remove "and perhaps add new ones.", your understanding is perfect.

If so, then you can indeed use the -u flag to the jar command, and you
do not need to extract the jar's contents first or anything like that.
I've got an application with a jar where we did just that recently for
one user in need of a rapid bug fix.

To do so, I made the fix and locally compiled the corrected class. Then
I recreated only the portion of the package structure inside the jar
file that contained the modified class file(s). I was able to use a jar
command somewhat like this:

jar -uf myjarfile.jar com

Not all the sub-packages of com were present, as I said. I could well
have included sub-packages that weren't even in the jar before, like
com.newpkg, though it wasn't needed in my case. But the end result was
that the "com" package hierarchy inside my jar file remained intact
except that any class or other files inside my "com" directory ended up
replacing their old counterparts, or got added if they weren't there
before.

OK, got you. Great, thanks a bunch. As a side note, this knowledge is
so helpful that I think I'll move some of the backup files under the
same package hierarchy, good practice or real necessity? More likely
the late.


Additional notes:
Good news and bad news. The good news is, the jar update seems
successful, no error msg showing up after running the jar utility for
update per your instruction. The bad news is, the HTML generation for
that particular set of data still failed. And probably I know why, the
previous developer also uses JBuilder (from Borland probably) for this
process, and I noticed that for every java source code, there's an
equivalent of ?.jbx (JBuilder Executable?)

.



Relevant Pages

  • Re: bummer
    ... > Damn, I hate bad news. ... actually as I mentioned to JaR, the worst was hearing on the radio this ...
    (microsoft.public.cert.exam.mcse)
  • Re: Marmite
    ... On the BBC Radio 4 news this morning it said they intended to ... introduce the tube but also to keep the jar. ...
    (alt.usage.english)
  • Re: Marmite
    ... On the BBC Radio 4 news this morning it said they intended to ... introduce the tube but also to keep the jar. ...
    (alt.usage.english)
  • Re: How to update a jar file for one source file change?
    ... Steve W. Jackson wrote: ... you're asking how to update an existing jar file to replace some parts ... that the "com" package hierarchy inside my jar file remained intact ...
    (comp.lang.java.programmer)
  • Re: javax.comm strange problem
    ... and now the .exe generated by JBuilder works but not the ... .jar I guess that's just some odd little thing I have to change. ... >> I figured out which jre was used by printing the java.home property. ...
    (comp.lang.java.programmer)