AlphaCode
AlphaCode

Reputation: 439

How to make class files into a JAR file

I have a JAR file that I wanted to edit a string inside on of it's classes . So I extracted it using Winrar , done the changes I wanted and saved it . Now I have a folder with subfolders inside that contains class files (about 30 one) .My question here is how can I recreate the Jar file from those folders&files ? Like it's it's doing the reverse action of extracting the Jar file .. ?

Upvotes: 0

Views: 258

Answers (2)

Quark
Quark

Reputation: 1618

Jar file is basically a zip file - however the best way to edit jars is to use a file manager (like Total Commander). You can delete, copy, rename, ... whatever, transparently inside the archive.

http://en.wikipedia.org/wiki/JAR_%28file_format%29

May be only one tip for the Total Commander - to enter the archive just use Ctrl-Pagedown. And I don't think that is something wrong on jar editing (in some circumstances you have no other option). However class files editing... it is a different game ...

Upvotes: 1

You could create a .zip file, rename it (with WinRAR) to something.jar so it becomes a .jar archive and then copy the folders in there.

But what you are doing is not really recommended to be done
You shouldn't extract and re-archive it like that.

And DON'T I repeat DON'T edit .class files!

Upvotes: 1

Related Questions