开发者

Updating .class file in a jar throws exception

开发者 https://www.devze.com 2023-01-01 23:05 出处:网络
I\'m trying to port a wikimedia plugin to run on OpenVMS and needed to alter a class. I\'m trying to update the .class file in the jar using jar uf jar-file .class-file, however when I do this I get t

I'm trying to port a wikimedia plugin to run on OpenVMS and needed to alter a class. I'm trying to update the .class file in the jar using jar uf jar-file .class-file, however when I do this I get the following:

java.util.zip.ZipException: duplicate entry: META-INF/LICENSE.txt
        at java.util.zip.ZipOutpu开发者_StackOverflow社区tStream.putNextEntry(ZipOutputStream.java:175)
        at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:90)
        at sun.tools.jar.Main.update(Main.java:507)
        at sun.tools.jar.Main.run(Main.java:184)

It turns out there are 2 LICENSE.txt files in the jar and I can't seem to get rid of them.

Any ideas on how to just get the new .class file into the jar or how to get rid of the duplicate file?


A jar file is just a zip, so unzip the JAR and then re-package it. Or open it with any graphical zip file utility and remove the duplicate entry.

0

精彩评论

暂无评论...
验证码 换一张
取 消