How-to · Peek Pro

Edit a file inside a JAR or WAR without unpacking it

You need to change one value in application.properties inside a WAR. The usual route is to unpack it, edit, and repack with the right paths and without a stray .DS_Store. Both ways below change the file in place.

JAR WAR EAR ZIP Peek Pro

With Peek

Edit in your own editor and save back

Opening the file is free. Saving the change back into the archive needs Peek Pro, which you can try free for 14 days.

1

Open the archive

Open the .jar, .war, .ear or .zip in Peek and find the file you want to change.

2

Open it in your editor

Use Open With to open the entry in your editor. Peek prepares a working copy of that one file.

3

Edit and save as usual

Save in the editor. Peek notices that the working copy changed.

4

Review the diff

Before anything is written, Peek shows a text diff of what you changed.

5

Save back

Confirm, and Peek writes that file back into the archive. A ZIP-based archive such as a JAR or a WAR is updated in place.

From the Terminal

Update one entry with jar or zip

Both tools store the path exactly as you type it, so the file has to sit at the same relative path as inside the archive.

# Take the file out, keeping its path
unzip app.war WEB-INF/classes/application.properties

# Edit it, then put it back
jar uf app.war WEB-INF/classes/application.properties

# The same with zip
zip app.war WEB-INF/classes/application.properties

Run it from the wrong folder and you add a second copy of the file at a different path, with the old one still there. List the archive afterwards to check.

Questions

Does editing a signed JAR break its signature?

Yes. Changing any signed entry invalidates the signature, whichever tool you use. Peek warns you before you edit a signed package.

Can I add, rename or delete files too?

Yes. With Peek Pro you can add, move, rename, duplicate and delete entries without unpacking and repacking.

Is the original archive kept?

The edit changes the archive you opened. Work on a copy if you need the original untouched.

Can I edit a compiled .class this way?

You can replace a .class with one you compiled. Peek does not edit bytecode or decompile to Java source.

More how-to guides

Other things people do with a JAR or a WAR

Free to download

Open, browse and extract for free. Try Peek Pro for 14 days.

Peek is a native Mac app from the Mac App Store. Nothing is charged when the trial ends; Peek Pro is a one-time purchase, with no subscription and no account.