Updating file in a jar throws ZipException

后端 未结 3 511
小蘑菇
小蘑菇 2021-01-18 00:13

I\'m trying to update a file in an existing jar (in this example antlr) using the command:

jar -uf antlrworks-1.2.3.jar org/antlr/codegen/templates/Java/Java         


        
3条回答
  •  孤街浪徒
    2021-01-18 00:45

    You can do the same operation with the Ant jar task.

    
       your files
    
    

    the duplicate attribute with the preserve value will take care of the duplicate entries.

    As mentioned here, the update attribute with the value “preserve” does tell you that duplicates exist, in this form:

     aPath/aFile already added, skipping
    

    If your file is on top of the list the jar task has to pick tp build itself, your new file will be taken into account.

提交回复
热议问题