Also, I couldn't find any mention in the spec (or other docs from sun) of file magic for jar files.
I believe the 0xcafe magic match is really for java class files. Most interesting jar files (especially executable jars) will have at least one class file, but once again I don't think any particular location in the file can be assumed.
OK, the spec http:// java.sun. com/javase/ 6/docs/ technotes/ guides/ jar/jar. html says "A JAR file is essentially a zip file that contains an optional META-INF directory." So the META-INF directory may not always exist.
Also, I couldn't find any mention in the spec (or other docs from sun) of file magic for jar files.
I believe the 0xcafe magic match is really for java class files. Most interesting jar files (especially executable jars) will have at least one class file, but once again I don't think any particular location in the file can be assumed.