How to extract a .jar file and create a 100% identical new one

I was playing around with the minecraft version files when I read about modifying the version.jar file to modify your game. I began to try out stuff and got stuck almost immediately.

I work on a Mac using the Terminal app.

My issue is the following:
I start having the version.jar file into a TEST folder.

  • First I run cd path_to_folder/TEST.
  • Then I run: jar -xf version.jar witch seems to extract the file filling the folder with .class files, some other files and some folders including the folder META-INF/MANIFEST.MF.

At this point I try to recreate the version.jar file.

  • First I delete the original version.jar file which is still present in TEST using rm version.jar.
  • I run jar -cmf META-INF/MANIFEST.MF 1.12.2_mod.jar * witch creates a new version.jar file.

Now I try to run it but it does not work. Analyzing the dimension of both files (before and after), I don't get the same size: the original is 10’180’113 bytes and the new one 10’195’006 bites.

How can I resolve my issue?


Before trying to use the terminal I used the native decompress tool of MacOS, then compressed it to zip and finally renamed the extention into .jar. Doesn't work.

Same result if I renamed first the .jar extention into .zip, decompressed, compressed and finally renamed the extention. Doesn't work.

I tried also to use Keka to compress and decompress zip files. Doesn't work.

I could try to inject files into the version.jar file, but I've had a hard time with the syntax of the command...


  • Hello myself from the past!

    To edit .jar files on a Mac without to extract and recreate you can do the following:

    • extract the whole version.jar on a new separate folder.
    cd path_to_folder/TEST
    mkdir tmp
    mv version.jar tmp/version.jar
    jar -xf tmp/version.jar
    • Inside the tmp folder you can select the files you want to edit and bring them outside inside path_to_folder/TEST.
    • delete the tmp folder.
    • Do the modifications you want into your freshly selected files.
    • To insert your modifications inside version.jar.
    cd path_to_folder/TEST
    jar -uf version.jar freshly_selected_file

    Now you can run your version.jar with your modifications.