Free JAR test files and sample generator

A Java archive: a ZIP carrying META-INF/MANIFEST.MF. Generate valid .jar sample files to test uploads, classpath tooling, scanners and build pipelines.

Generate a .jar file →

What is a .jar file?

JAR: Java Archive. A JAR is a ZIP archive with a META-INF/MANIFEST.MF, used to ship Java libraries and applications. Tooling often reads the manifest as a stream, which is why the manifest's position in the archive matters.

Why generate a test JAR file?

What you can put inside a .jar file

You get 3 content options for JAR, so the file holds something meaningful rather than random padding: Text files, Mixed file types, Many small files. For JAR these are alternatives, so choose the one that matches what you need to test.

How a .jar file is identified

Every .jar file begins with 50 4B 03 04, the ASCII letters "PK", the initials of Phil Katz, who created the ZIP format. That is what a validator inspecting content rather than the file name looks for.

How the size lands on the exact byte

The package is a ZIP, so the padding is trailing whitespace inside one of the XML parts it already contains. Extractors and Office readers both ignore it, so the document opens unchanged.

Negative testing with broken JAR files

Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation.

Sample JAR content

[JAR], ZIP container: META-INF/MANIFEST.MF + packaged resource files.

This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.

How to open and verify the file

List with `jar tf file.jar` or `unzip -l file.jar`; read the manifest with `unzip -p file.jar META-INF/MANIFEST.MF`.

Media type application/java-archive · extension .jar · category Archives

Generate a .jar file → · questions about sizes, privacy or cost are answered on the site FAQ.

Frequently asked questions about JAR files

What identifies a .jar file?

A .jar file begins with the bytes 50 4B 03 04, the ASCII letters "PK", the initials of Phil Katz, who created the ZIP format. Those bytes are what a content-sniffing validator looks for, and what the Corrupted condition destroys.

How can a .jar file be an exact number of bytes?

The package is a ZIP, so the padding is trailing whitespace inside one of the XML parts it already contains. Extractors and Office readers both ignore it, so the document opens unchanged.

What can go inside the JAR file?

There are 3 content options for .jar: Text files, Mixed file types, Many small files. For JAR these are alternatives, so pick the one matching what you need to test.

Can I download several broken JAR files at once?

Yes, select more than one File Condition and you get one ZIP containing a .jar per condition, each named after its condition.

Can the JAR file use UTF-16 or a byte-order mark?

No, and deliberately. A .jar file is a container rather than plain text, so rewriting its bytes as UTF-16 would not produce a UTF-16 document. It would produce a broken file. Use a text format such as CSV, JSON or XML for encoding tests.

How do I open or verify the JAR file?

List with jar tf file.jar or unzip -l file.jar; read the manifest with unzip -p file.jar META-INF/MANIFEST.MF.

Related Archives formats

ZIP · TAR · GZ · 7Z · RAR · WAR · ISO

Browse all file formats →