By Alvin Alexander. Last updated: June 6, 2016
Java Jar file FAQ: Is there an easy way to delete a file from a Jar file?
Yes. Because a Jar file is just a Zip file, you can use the zip command to remove a file from a Jar file, like this:
zip -d MyApp.jar fileToDelete.foo
Of course the file to delete can be any sort of file. I just went through this process where I had to delete a configuration file, and my command looked like this:
zip -d sarah.jar application2.conf
It’s a long story about why I had to do that, but in summary, if you need to delete a file in a Java Jar file, I can confirm that this works.