Sameer Shinde
Sameer Shinde

Reputation: 61

How to delete a file from a jar which is part of another jar

I need to remove JMSAppender class from log4j-1.2.17.jar. This jar is wrapped in my executable jar named xyz.jar. What is the most effective and easy way to delete JMSAppender class and make the jar as it is again?

File directory looks like this:

xyz.jar
|- BOOT-INF/lib/log4j-1.2.17.jar
|- META-INF
|- org

log4j-1.2.17.jar
|- org
|---apache
|-----log4j
|-------net
|---------JMSAppender.class
|- META-INF

Upvotes: 0

Views: 591

Answers (1)

queeg
queeg

Reputation: 9372

A jar file is nothing different than a zip archive renamed to '.jar'. Therefore any solution to remove or change something in a zip file is applicable, such as

There may be problems however if that jar carries a signature. In that case any recipient would be able to verify that the signature is broken which means the file was tampered with. To learn about signed jars, read

Upvotes: 1

Related Questions