Convert zip to jar

Convert ZIP to JAR

Repack a ZIP as a JAR, add Java metadata, and test executable archives.

Convert ZIP files online

We don’t have a dedicated online converter for ZIP to JAR yet, but you can convert ZIP files online to these formats:

Want to convert ZIP to JAR?

Let us know. We pick the conversions to add next by how many people ask for them.

How to convert zip to jar file

A Java runtime, mod loader, or plugin system may require a .jar file instead of a .zip archive. Because JAR uses the ZIP container, simple repacking is usually lossless, but an executable JAR also needs compiled classes and a valid manifest.

What the ZIP format is

ZIP is a general-purpose compressed archive for bundling files and folders for downloads, sharing, backups, and storage. Windows File Explorer, macOS Archive Utility, Linux archive managers, 7-Zip, WinZip, and development tools create ZIP files. A ZIP can contain source code, documents, images, compiled classes, libraries, or other archives, but it does not require Java-specific metadata or directory structure.

What the JAR format is

JAR, or Java Archive, is a ZIP-based archive for Java classes, resources, libraries, and applications. It may contain META-INF/MANIFEST.MF, package directories, digital-signature files, and multi-release Java content. An executable JAR requires a manifest entry such as Main-Class: com.example.Main, allowing it to run with java -jar. Java tools, build systems, application servers, mod loaders, and plugin systems may require the .jar extension even when the underlying files are ZIP-compatible.

How to create a non-executable JAR

  1. Install a JDK for the jar command, or install a desktop archive utility such as 7-Zip.
  2. Extract the ZIP into a temporary directory. Do not put the original ZIP inside the new archive.
  3. Check the extracted layout. If the ZIP contains one unnecessary top-level directory, use that directory's contents only when the receiving software expects files at the JAR root.
  4. Open a terminal in the extracted folder's parent directory and run jar --create --file output.jar -C extracted-folder .. On older JDK releases, use jar cf output.jar -C extracted-folder ..
  5. Inspect the result with jar --list --file output.jar and verify that package paths and resources appear where the application expects them.

With 7-Zip, choose Extract to <folder>, open the extracted folder, select its contents, and choose 7-Zip → Add to archive. Select ZIP as the archive format, then rename the result from output.zip to output.jar only if the target software needs the JAR extension. This produces a ZIP-compatible JAR but does not make it executable or add Java metadata.

How to create an executable JAR

  1. Compile the Java source files with the JDK. A source file such as Main.java is not executable merely because it is placed in a JAR.
  2. Preserve package paths: a class declared as package com.example; belongs at com/example/Main.class.
  3. Create a plain-text MANIFEST.MF containing Main-Class: com.example.Main followed by a final newline. The value must name the class, not the source filename, and must not include .class.
  4. Build the archive with jar --create --file app.jar --manifest MANIFEST.MF -C extracted-folder .. With newer JDK versions, jar --create --file app.jar --main-class com.example.Main -C extracted-folder . can set the entry without a separate manifest file.
  5. Test it with java -jar app.jar. A missing class, incorrect package path, malformed manifest, absent dependency, or wrong main-class name prevents execution.

For Maven or Gradle projects, use the project build rather than repacking an arbitrary ZIP: mvn package or gradle build can compile classes and create the required manifest. A normal JAR does not automatically contain external dependencies; use the project's supported assembly or shading configuration when a self-contained JAR is required.

Online and desktop tools

The JDK jar utility is the most reliable choice because it preserves Java archive conventions and supports manifests. 7-Zip is suitable for non-executable repacking and inspection. For a browser-only conversion, an archive service such as Aspose's online converter may be usable for non-confidential files, but verify that its current format list explicitly offers JAR output. Do not upload source code, proprietary libraries, signing keys, credentials, or other sensitive archive contents.

Compatibility limitations

Renaming a ZIP does not compile Java code, create a manifest, change package paths, or add dependencies. Rebuilding normally preserves file contents without quality loss, although compression settings, timestamps, permissions, encryption, and archive metadata may change. ZIP encryption is not a standard requirement for JAR files, and encrypted input may not survive a JDK-based rebuild.

Repacking a signed JAR invalidates its signature because archive contents and signature metadata no longer match. Preserve the original directory structure, inspect the archive after creation, and test it with the exact Java version and receiving software that will use it.

ZIP vs JAR: format comparison

How the ZIP and JAR formats compare on the properties that matter most for this conversion.

Comparison of the ZIP and JAR file formats
Property .ZIP ZIP archive .JAR Java Archive
Compression Both Both
Compression ratio Medium Medium
Encryption Yes Yes
Split archives Yes No
Recovery record No No
Operating system support Wide Wide
Typical file size Medium Medium
Open standard Yes Yes
Introduced 1989 1996
Developer Phil Katz / PKWARE Oracle (originally Sun Microsystems)
MIME type application/zip application/java-archive