Java Development Tools

Javac – The Java Compiler

javac [ options ] filename.java ...

javac_g [ options ] filename.java ...

 

The javac command compiles Java source code into Java bytecodes. You then use the Java interpreter - the java command - to interprete or execute the Java bytecodes.

Java source code must be contained in files whose filenames end with the .java extension. The file name must be constructed from the class name, as classname.java, if the class is public or is referenced from another source file.

 

For every class defined in each source file compiled by javac, the compiler stores the resulting bytecodes in a class file with a name of the form classname.class. Unless you specify the -d option, the compiler places each class file in the same directory as the corresponding source file.

Java / javaw - The Java Application Launcher

java [ options ] classname <args>

javaw [ options ] classname <args>

 

The java program launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. The java program executes Java .class files created by a Java compiler, for instance, javac.

The classname argument is the name of the class to be executed. classname must be fully qualified by including its package in the name, for example:

 

C:\>java java.lang.String

 

Note that any arguments that appear after classname on the command line are passed to the main method of the class.  Java expects the binary representation of the class to be in a file named after the class. Thus, class String would be in String.class which is generated by compiling the corresponding String.java source file with javac. All Java class files end with the filename extension .class which the compiler automatically adds when the class is compiled. The class must contain a main method defined as follows:

 

   class Aclass {

       public static void main(String argv[]){

           . . .

       }

   }

 

java executes the main method and then exits unless main creates one or more threads. If any threads are created by main then java doesn't exit until the last thread exits.   Javaw is a form of launcher where a text-based system console is not displayed.

Jdb – The Java Debugger

jdb [ options ]

 

The Java Debugger, jdb, is a dbx-like command-line debugger for Java classes. It uses the Java Debugger API to provide inspection and debugging of a local or remote Java interpreter.

 

Jar – Java Archive

JAR (Java Archive) is a platform-independent file format that aggregates many files into one. Multiple Java applets and their requisite components (.class files, images and sounds) can be bundled in a JAR file and subsequently downloaded to a browser in a single HTTP transaction, greatly improving the download speed. The JAR format also supports compression, which reduces the file size, further improving the download time. In addition, the applet author can digitally sign individual entries in a JAR file to authenticate their origin.

javadoc - The Java API Documentation Generator

javadoc [ options ] [ package | source.java ]*

 

javadoc parses the declarations and documentation comments in a set of Java source files and produces a set of HTML pages describing, by default, the public and protected classes, interfaces, constructors, methods, and fields. As an argument to javadoc you pass in either a series of Java package names or source files.

 

javadoc generates one .html file for each .java file and each packages it encounters. In addition, it produces a class hierarchy (tree.html) and an index of those members (AllNames.html).  When javadoc parses the class and member delarations, it picks up their signatures for inclusion. In addition, you can add further documentation by including doc comments in the source code.

 

You can include documentation comments in the source code. A doc comment consists of the characters between the /** that begins the comment and the */ that ends it. The text is divided into one or more lines. When javadoc parses a doc comment, leading * characters on each line are discarded; for lines other than the first, blanks and tabs preceding the initial * characters are also discarded. These comments may include HTML tags. Here is a doc comment:

 

/**

 * This is a <b>doc</b> comment.

 */

 

The first sentence of each doc comment should be a summary sentence, containing a concise but complete description of the declared entity. This sentence ends at the first period that is followed by a blank, tab, or line terminator, or at the first tag (as defined below). javadoc copies this first sentence to the member summary at the top of the .html file.

 

Documentation comments are only recognized when placed immediately before class, interface, constructor, method, or field declarations.

 

When you embed HTML tags within a doc comment, you should not use heading tags such as <h1> and <h2>, because javadoc creates an entire structured document and these structural tags interfere with the formatting of the generated document.