.jar MIME type
Java archiveapps & binaries
application/java-archiveJava libraries and applications, packaged as ZIP archives.
| MIME type | application/java-archive |
|---|---|
| Extensions | .jar |
| Content-Type | application/java-archive |
| Compress in transit? | No — already compressed |
| File signature | 50 4B 03 04 (PK..) the ZIP signature — this format is a ZIP archive inside |
Good to know
- Web and enterprise variants use
.warand.earwith the same structure.
Serve .jar files with the right type
The response header to send:
Content-Type: application/java-archive
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
application/java-archive jar;
Apache (.htaccess or server config)
AddType application/java-archive .jar
Express
res.set("Content-Type", "application/java-archive");Python
import mimetypes
mimetypes.add_type("application/java-archive", ".jar")HTML file input
<input type="file" accept=".jar,application/java-archive">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.jar | grep -i '^content-type:' file --mime-type file.jar
Frequently asked questions
What is the MIME type for .jar files?
application/java-archive.
What Content-Type header should a .jar file be served with?
Content-Type: application/java-archive. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .jar?
Check its bytes rather than the extension: JAR files start with 50 4B 03 04 (PK..) — the ZIP signature — this format is a ZIP archive inside. On the command line, file --mime-type name.jar does this for you.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options