13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

122Chapter 5The Sun Microsystems Java Software <str<strong>on</strong>g>Development</str<strong>on</strong>g> KitThe class invoked must be findable <strong>on</strong> either the bootstrap or userspecifiedclasspath.5.4.2 java Opti<strong>on</strong>sJust as the Java compiler, the runtime program, java, takes a number of command-lineopti<strong>on</strong>s. Here are the most comm<strong>on</strong>ly used <strong>on</strong>es:-classpath or -cpSets the runtime classpath. Overrides any value in the CLASSPATHenvir<strong>on</strong>ment variable.-Dproperty=valueAllows a system property to be set <strong>on</strong> the command line.-jarSpecifies that the first n<strong>on</strong>opti<strong>on</strong> command-line argument is not a Javaclass name, but the name of a JAR file. The JAR file must have aMain-Class: specificati<strong>on</strong> in its MANIFEST (see Secti<strong>on</strong> 5.11). Themain() method of the class named by the JAR’s MANIFEST Main-Class:specificati<strong>on</strong> will be called as if that class had been named <strong>on</strong> the commandline, rather than the JAR file. This is comm<strong>on</strong>ly used in shell scripts andbatch files that accompany Java applicati<strong>on</strong>s distributed in single.jar files.There are several other command-line opti<strong>on</strong>s that are less comm<strong>on</strong>lyused. We will cover some of them in later chapters when their use will makemore sense. Of course, full documentati<strong>on</strong> <strong>on</strong> all opti<strong>on</strong>s for this command isin the Sun Java SDK <str<strong>on</strong>g>Development</str<strong>on</strong>g> Tools documentati<strong>on</strong>.5.5COMPLETE, UP-TO-DATE PROGRAM DOCUMENTATION MADE EASYOne of Java’s most useful features is javadoc, a command that (by default)produces comprehensive HTML program documentati<strong>on</strong> directly from theprogram source. Since it works from the source, it can be automated, and youmay be certain that the documentati<strong>on</strong> is up-to-date. It takes much of thedocumentati<strong>on</strong> burden off of programmers and permits new programmers tojoin a project and rapidly come up to speed because there is comprehensivedocumentati<strong>on</strong> in a standard format. The javadoc tool produces HTML

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!