Jump to content

How to edit / re-pack a jar file?


Recommended Posts

Hi guys,

new short question.How can I edit files packet in a jar (Java) package?So in my case I just need to change some text in a class file and thats all but the package need to be extracted first before I can do that.I tried using 7z to see the content of the jar package and I did extract all files now and then I did edit one file and now I need to build a jar file again.Anyhow I can not do that with 7z and the main app does fail to run with my compressed jar file package.So what can I do now?As I said the change I did is pretty simple but how to repack it again?Do you have any methods (easy) I can try?Thanks.


Link to comment

Info: Ok I found a info using the zip format in 7z to build a new jar package and it seems to work. :) Coolio!The new package has the double size but anyway so long it work.If you have some more infos I need to know about that etc then just post it.Thanks.


Link to comment


jar-The Java Archive Tool

jar combines multiple files into a single JAR archive file.


The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly to facilitate the packaging of java applets or applications into a single archive. When the components of an applet or application (.class files, images and sounds) are combined into a single archive, they may be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tar command. A jar archive can be used as a class path entry, whether or not it is compressed.

Typical usage to combine files into a jar file is:

C:\Java> jar cf myFile.jar *.class





  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...