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



In article <1164749276.472816.155480@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"NickName" <dadada@xxxxxxxx> wrote:

Hi,

I'm new to java, so, I may get terminilogy wrong, bear with me. Here's
the problem. We use a set of tools to perform data extraction from a
repository into XML, then generate HTML for them. For this process,
we've got a BIG jar file that includes thousands of classes. Now,
recently a piece of data that includes section symbol, § was added to
the repository. The current extraction process does not include java
code for automatic translation into HTML encoded code, so, it stops the
HTML generation for this particular piece of data. Process-wise, it's
XML extraction from repository and then HTML (files) generation from
the XML files. As it stands, the second process of HTML generation for
this particular set of data failed.

Given the situation, we added the § to HTML encoded code to a piece of
java code that is being used during the data extraction and HTML
publishing process. However, when we ran a test, results indicate the
process has not translated the symbol, which also means that the
updated java source code was not being used. So, here are some
questions,
the BIG jar file uses some packages, one of which references this
particular java source code.
I've looked jar utility syntax, an inital thought was, to update this
jar file to recompile the updated java source code, however, however,
all the links/references on the web that I've looked at about jar
utility do not indicate how to update a jar file that includes an
updated java file.
Would using the u option alone update all? Then, it does not make
sense for the other thousands of files.

Secondly, how about re-package the package that reference this piece of
java code? Would the re-package recompiled all the referenced java
code/classes? Would I have to do something about the BIG jar file that
references this package or now it's been "updated"?

Many thanks.

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.

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.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
.



Relevant Pages

  • Re: Running java programs from class files
    ... java -classpath /xyz/abc MyPackage.MyClass ... But put it in a package and it won't. ... So now that you solved that one, show me how to use a jar library on the ... line in the manifest and put the jar file in the same ...
    (comp.lang.java.programmer)
  • Re: please help me
    ... I have a jar file which I want carried out since an interface java ... But the window of the file launches out and is established after a few ... Windows) or a Java Frame or JFrame? ...
    (comp.lang.java.programmer)
  • How to update a jar file for one source file change?
    ... I'm new to java, so, I may get terminilogy wrong, bear with me. ... then generate HTML for them. ... we've got a BIG jar file that includes thousands of classes. ... updated java source code was not being used. ...
    (comp.lang.java.programmer)
  • Re: license question?
    ... And i will include that GPL jar file into my jar file. ... -In Java, it would probably be considered a static link. ...
    (comp.lang.java.programmer)
  • Re: license question?
    ... And i will include that GPL jar file into my jar file. ... -In Java, it would probably be considered a static link. ...
    (comp.os.linux.misc)