The syntax of the jar command is intentionally very similar to that of the Unix tar
command. This similarity is the reason why jar uses command options, rather than
switches (as the other Java platform commands do).
When creating a .jar file, the jar tool will automatically add a directory called
META-INF that contains a file called MANIFEST.MF —this is metadata in the form
of headers paired with values. By default, MANIFEST.MF contains just two headers:
Created-By: 1.8.0 (Oracle Corporation)
By using the m option, additional metadata can be added into MANIFEST.MF at JAR
creation time. One frequently added piece is the Main-Class: attribute, which indi‐
cates the entry point into the application contained in the JAR. A JAR with a speci‐
fied Main-Class: can be directly executed by the JVM, via java -jar .
The addition of the Main-Class: attribute is so common that jar has the e option
to create it directly in MANIFEST.MF , rather than having to create a separate text
file for this purpose.
P r o i l e s
javadoc produces documentation from Java source files. It does so by reading a spe‐
cial comment format (known as Javadoc comments) and parsing it into a standard
documentation format, which can then be output into a variety of document for‐
mats (although HTML is by far the most common).
For a full description of Javadoc syntax, refer to Chapter 7 .
Define the classpath to use
Tell javadoc where to output the generated docs
Suppress output except for errors and warnings
The platform API docs are all written in Javadoc.