Rhino wrote:
>
> Given a jar that contains entries representing files (as opposed to
> directories), is it possible to add new file entries to the jar or to remove
> (permanently delete) entries from the jar *programmatically*? (I know that I
> can add files to a jar via the jar -u option on the command line.)
>
> I want my program to be able to add and remove files from a jar but it's
> beginning to look like the only way I can accomplish deletions is to make a
> new copy of the jar and copy over everything but the file that is to be
> deleted, then replace the old jar with the new one. And I may have to use
> runtime.exec() to add a new file programmatically. Both options are pretty
> ugly but I don't see anything useful in the API, like add() or delete()
> methods in either the JarFile or JarEntry classes.
>
> Am I missing something? If yes, please tell me the basic approach to
> adding/deleting jar entries.
You didn't miss anything. The only way to add/delete jar entries is to make a new copy
of the jar. That's what the utilities do.
--
Lee Fesperman, FFE Software, Inc. (
http://www.firstsql.com)
================================================== ============
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (
http://www.firstsql.com)