Java Reference
In-Depth Information
@see class # method —This tag indicates the name of a method of another class,
which will be used for a hyperlink directly to the documentation of that method.
This is usable without restriction.
n
@since text —This tag indicates a note describing when a method or feature was
added to its class library.
n
The jar Java File Archival Tool
When you deploy a Java program, keeping track of all the class files and other files
required by the program can be cumbersome.
B
To make this easier, the kit includes a tool called jar that can pack all a program's files
into a Java archive—also called a JAR file. The jar tool also can be used to unpack the
files in one of these archives.
JAR files can be compressed using the Zip format or packed without using compression.
To use the tool, type the command jar followed by command-line options and a series of
filenames, folder names, or wildcards.
The following command packs all a folder's class and GIF image files into a single Java
archive called Animate.jar :
jar cf Animate.jar *.class *.gif
The argument cf specifies two command-line options that can be used when running the
jar program. The c option indicates that a Java archive file should be created, and f indi-
cates that the name of the archive file will follow as one of the next arguments.
You also can add specific files to a Java archive with a command such as the following:
jar cf MusicLoop.jar MusicLoop.class muskratLove.mp3 shopAround.mp3
This creates a MusicLoop.jar archive containing three files: MusicLoop.class ,
muskratLove.mp3 , and shopAround.mp3 .
Run jar without any arguments to see a list of options that can be used with the tool.
One use for jar is to put all files necessary to run a Java applet in a single JAR file. This
makes it much easier to deploy the applet on the web.
The standard way of placing a Java applet on a web page is to use an applet or object
tag to indicate the primary class file of the applet. A Java-enabled browser then down-
loads and runs the applet. Any other classes and any other files needed by the applet are
downloaded from the web server.
 
Search WWH ::




Custom Search