0

I am developing a program that automatically modifies a jar file with already obtained class files(I am modding Minecraft automatically, to be exact). This would involve unpacking the jar into a folder, editing the files(just a simple use of the File class), and repacking the jar and deleting the temporary folder with the edited files. So, how would I go about decompressing/recompressing the jar file?

Flafla2
  • 691
  • 2
  • 11
  • 21

1 Answers1

2

With the JarFile class (which inherits behavior from the ZipFile class).

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • How can I use JarFile to compress a directory full of .class files to a jar file, and vice versa? I can't find it in the docs...... – Flafla2 Nov 05 '11 at 02:27
  • Poke around a bit... There's also JarInputStrem, JarOutputStream, and the same for zip files. And this site called [stackoverflow where people ask questions just like that ;)](http://stackoverflow.com/questions/1281229/how-to-use-jaroutputstream-to-create-a-jar-file) – Dave Newton Nov 05 '11 at 02:40
  • Thanks, man! I think "poking around", as you call it is really a skill as a dev that I need to develop further. Checked! – Flafla2 Nov 05 '11 at 03:30
  • @Flafla2 Oh, man, there's no *end* to the poking around, believe me! Probably one of the most important skills there is, though, IMO. Something I look for when hiring. – Dave Newton Nov 05 '11 at 03:33