Monday, 1 October 2012

Java Tools javap,javadoc,javah,jar,javaw,jdb,jad






Java javap tool
The javap tool disassembles compiled Java™ files and prints out a representation of the Java program. This may be helpful when the original source code is no longer available on a system.

-b
This option is ignored. Backward compatibility is not required, because Java on the System i5™ only supports recent version sof the Java Development Kit (JDK).
-p
On the System i5, -p is not a valid option. You must spell out -private.
-verify
This option is ignored. The javap tool does not do verification on the System i5.
The javap tool is available using the Qshell Interpreter.

Note: The use of the javap tool to disassemble classes may violate the license agreement for those classes. Consult the license agreement for the classes before using the javap tool.

Javadoc Tool


Javadoc is a tool that parses the declarations and documentation comments in a set of source files and produces a set of HTML pages describing the classes, inner classes, interfaces, constructors, methods, and fields.
You can use Javadoc doclets to customize Javadoc output. A doclet is a program written with the doclet API that specifies the content and format of the output to be generated by the javadoc tool. You can write a doclet to generate any kind of text-file output, such as HTML, SGML, XML, RTF, and MIF. SunTM provides a "standard" doclet for generating HTML-format API documentation and an experimental MIF doclet for generating MIF, PDF, PS, RTF, FrameMaker, and other formats. Doclets can also be used to perform special tasks not related to producing API documentation. For example, a diagnostic doclet could be created to check that all class members of the classes on which Javadoc operates have documentation comments.

Javadoc Enhancements
Describes the new features.
What's New in Javadoc 1.4.2
What's New in Javadoc 1.4.1
What's New in Javadoc 1.4.0
What's New in Javadoc 1.3
What's New in Javadoc 1.2.2
What's New in Javadoc 1.2

Javadoc Tool Reference Page
References pages listing all javadoc tags and command-line options. Shows how to run the Javadoc tool, with examples in Solaris and Microsoft Windows.
Javadoc 1.4.2 Tool Reference Page (Solaris)
Javadoc 1.4.2 Tool Reference Page (Microsoft Windows)

Doclet API
Doclet Overview - Provides an introduction to doclets with simple examples that illustrate the Doclet API.
Doclet API - Documentation for the com.sun.javadoc package, which comprises the Doclet API.

Taglet API
Taglet Overview - Provides an introduction to taglets with simple examples that illustrate the Taglet API.
Taglet API - Documentation for the com.sun.tools.doclets.Taglet class, which comprises the Taglet API.

Doclets
Standard Doclet - the doclet that produces the default HTML-formatted API documentation. Javadoc uses the standard doclet if no other doclet is specified with Javadoc's -doclet option.

MIF Doclet - Experimental - generates API documentation in MIF (Maker Interchange Format). These MIF files can then be opened in Adobe FrameMaker (or fmbatch) and optionally converted to PDF, PS, Microsoft RTF, Microsoft Word or WordPerfect. Not included in Java 2 SDK.

DocCheck Doclet - Experimental - reviews Javadoc comments in the source code, identifying gaps and irregularities, and producing an HTML report that displays serious and trivial problems and suggests changes.
Third Party Doclets - Developed outside of Sun.

Let Us Know about Your Doclets
We'd like to know about doclets that you create. If you would like us to consider adding a link from the doclets page to your doclet's output, send the URL to email address  .

For More Information
Located on the website:
Javadoc FAQ - Important tips and workarounds for bugs.

Javadoc Forum - Enter into discussions with fellow developers. You must join the Java Developer Connection (free) to take part. Click on "Javadoc Tool" category. This forum is monitored only occasionally by the Javadoc team. If you want a prompt reply from the Javadoc team, use the email address below.
Submitting Bugs:

What Bugs Are in Javadoc? - Please see if your bug or feature request is already in our database:
How Do I Submit Bugs and Feature Requests? - Then submit your bugs and feature requests according to these instructions.

Javadoc announcements email group - A public one-way mailing list you can subscribe to for receiving major announcements about Javadoc tool, the standard doclet, the MIF doclet, the DocCheck doclet, the localization doclet, and others. Traffic should be light.

Email Address for the Javadoc Team - While we read all comments, and try to reply to every one, replies are not guaranteed.

Javadoc Tool Home Page - Covers all versions of the Javadoc tool.



Java javah tool
The javah tool facilitates the implementation of Java™ native methods. It is compatible with the javah tool that is supplied by Sun Microsystems, Inc. with a few exceptions.


Note: Writing native methods means that your application is not 100% pure Java. It also means that your application is not directly portable across platforms. Native methods are, by nature, platform or system-specific. Using native methods may increase your development and maintenance costs for your applications.
The javah tool is available using the Qshell Interpreter. It reads a Java class file and creates a C-language header file in the current working directory. The header file that is written is an System i5™ Stream File (STMF). It must be copied to a file member before it can be included in a System i5 C program

The javah tool is compatible with the tool that is provided by Sun Microsystems, Inc. If these options are specified, however, the server ignores them.

-td
The javah tool on the System i5 does not require a temporary directory.
-stubs
Java on the System i5 only supports the Java Native Interface (JNI) form of native methods. Stubs were only required for the pre-JNI form of native methods.
-trace
Relates to the .c stub file output, which Java on the System i5 does not support.
-v
Not supported.



jar-The Java Archive Tool

Combines multiple files into a single JAR archive file.
Synopsis
Description
Options
Command Line Argument Files
Examples
See Also
SYNOPSIS

Create jar file
jar c[v0M]f jarfile [-C dir] inputfiles [-Joption]
jar c[v0]mf manifest jarfile [-C dir] inputfiles [-Joption]
jar c[v0M] [-C dir] inputfiles [-Joption]
jar c[v0]m manifest [-C dir] inputfiles [-Joption]
Update jar file
jar u[v0M]f jarfile [-C dir] inputfiles [-Joption]
jar u[v0]mf manifest jarfile [-C dir] inputfiles [-Joption]
jar u[v0M] [-C dir] inputfiles [-Joption]
jar u[v0]m manifest [-C dir] inputfiles [-Joption]
Extract jar file
jar x[v]f jarfile [inputfiles] [-Joption]
jar x[v] [inputfiles] [-Joption]
List table of contents of jar file
jar t[v]f jarfile [inputfiles] [-Joption]
jar t[v] [inputfiles] [-Joption]
Add index to jar file
jar i jarfile [-Joption]
where:

cuxtiv0Mmf
Options that control the jar command.
jarfile
Jar file to be created (c), updated (u), extracted (x), or have its table of contents viewed (t). The f option and filename jarfile are a pair -- if either is present, they must both appear. Note that omitting f and jarfile accepts a "jar file" from standard input (for x and t) or sends the "jar file" to standard output (for c and u).
inputfiles
Files or directories, separated by spaces, to be combined into jarfile (for c and u), or to be extracted (for x) or listed (for t) from jarfile. All directories are processed recursively. The files are compressed unless option O (zero) is used.
manifest
Pre-existing manifest file whose name: value pairs are to be included in MANIFEST.MF in the jar file. The m option and filename manifesfile are a pair -- if either is present, they must both appear. The letters m and f must appear in the same order that manifest and jarfile appear.
-C dir
Temporarily changes directories to dir while processing the following inputfiles argument. Multiple -C dir inputfiles sets are allowed.
-Joption
Option to be passed into the Java runtime environment. (There must be no space between -J and option).
DESCRIPTION

The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly to facilitate the packaging of java applets or applications into a single archive. When the components of an applet or application (.class files, images and sounds) are combined into a single archive, they may be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tar command. A jar archive can be use as a class path entry, whether it is compressed or not.
Typical usage to combine files into a jar file is:

C:\Java> jar cf myFile.jar *.class
In this example, all the class files in the current directory are placed into the file named "myFile.jar". A manifest file entry named META-INF/MANIFEST.MF is automatically generated by the jar tool and is always the first entry in the jar file. The manifest file is the place where any meta-information about the archive is stored as name: value pairs. Refer to the JAR file specification for details about how meta-information is stored in the manifest file.
If you have a pre-existing manifest file whose name: value pairs you want the jar tool to include for the new jar archive, you can specify it using the m option:

C:\Java> jar cmf myManifestFile myFile.jar *.class
Be sure that any pre-existing manifest file that you use ends with a new line. The last line of a manifest file will not be parsed if it doesn't end with a new line character. Note that when you specify "cfm" instead of "cmf" (i.e., you invert the order of the "m" and "f" options), you need to specify the name of the jar archive first, followed by the name of the manifest file:
C:\Java> jar cfm myFile.jar myManifestFile *.class
The manifest is in a text format inspired by RFC822 ASCII format, so it is easy to view and process manifest-file contents.
To extract the files from a jar file, use x, as in:

C:\Java> jar xf myFile.jar
To extract only certain files from a jar file, supply their filenames:

C:\Java> jar xf myFile.jar foo bar
Beginning with version 1.3 of the Java 2 SDK, the jar utility supports JarIndex, which allows application class loaders to load classes more efficiently from jar files. If an application or applet is bundled into multiple jar files,  only the necessary jar files will be downloaded and opened to load classes. This performance optimization is enabled by running jar with the i option. It will generate package location information for the specified main jar file and all the jar files it depends on, which need to be specified in the Class-Path attribute of the main jar file's manifest.

C:\Java> jar i main.jar
In this example, an INDEX.LIST file is inserted into the META-INF directory of main.jar.
The application class loader will use the information stored in this file for efficient class loading.  Refer to the JarIndex specification for details about how location information is stored in the index file.

A standard way to copy directories is to first compress files in dir1 to standard out, then extract from standard in to dir2 (omitting f from both jar commands):

C:\Java> (cd dir1; jar c .) | (cd dir2; jar x)
Examples of using the jar tool to operate on jar files and jar file manifests are provided below and in the Jar trail of the Java Tutorial.




The java and javaw commands
An overview of the java and javaw commands.

Purpose
The java and javaw tools start a Java application by starting a Java Runtime Environment and loading a specified class.

The javaw command is identical to java, except that javaw has no associated console window. Use javaw when you do not want a command prompt window to be displayed. The javaw launcher displays a window with error information if it fails.

Usage
The JVM searches for the initial class (and other classes that are used) in three sets of locations: the bootstrap class path, the installed extensions, and the user class path. The arguments that you specify after the class name or jar file name are passed to the main function.

The java and javaw commands have the following syntax:

java [ options ] <class> [ arguments ... ]
java [ options ] -jar <file.jar> [ arguments ... ]
javaw [ options ] <class> [ arguments ... ]
javaw [ options ] -jar <file.jar> [ arguments ... ]
Parameters
[options]
Command-line options to be passed to the runtime environment.
<class>
Startup class. The class must contain a main() method.
<file.jar>
Name of the jar file to start. It is used only with the -jar option. The named jar file must contain class and resource files for the application, with the startup class indicated by the Main-Class manifest header.
[arguments ...]
Command-line arguments to be passed to the main() function of the startup class.

Obtaining version information
You obtain the IBM® build and version number for your Java installation using the -version or -fullversion options. You can also obtain version information for all jar files on the class path by using the -Xjarversion option.

Specifying Java options and system properties
You can specify Java options and system properties on the command line, by using an options file, or by using an environment variable.
Standard options

The definitions for the standard options.
Globalization of the java command
The java and javaw launchers accept arguments and class names containing any character that is in the character set of the current locale. You can also specify any Unicode character in the class name and arguments by using Java escape sequences.





No comments:

Post a Comment

There was an error in this gadget