Invalid jar files after compression

How do I compress a jar file with a manifest file and keep it executable? For example I was trying to use the following to create an executable jar:

bjwflate -s 513 A.class META-INF\MANIFEST.MF

Whenever I try to run it it tells me the jar file is corrupt. This happens a lot after using certain optimizers as well. I also verified that I can create a jar file with the jar command and 7zip that runs ok.

Thanks,
Casey

With bjwflate, cd to the directory with your class file and meta-inf folder and type

bjwflate -r gameName.zip *

Then rename gameName.zip to gameName.jar

Basically, bjwflate flattens the contents of the file when you do it that way - in other words, the manifest is no longer under meta-inf, and thus the jar is invalid.

Doing it Hsaka’s way should maintain the folder structure, and it should end up being valid.