What's New in 1.1? |
JAR (Java ARchive) is a platform-independent file format that allows you to bundle a Java applet and its requisite components (.class
files, images and sounds) into a single JAR file. Using the newARCHIVE
attribute of the <APPLET> tag, this bundle can be downloaded to a browser in a single HTTP transaction, greatly improving the download speed. In addition, JAR supports compression, which reduces the file size, further improving the download time.Finally, the applet author can digitally sign individual entries in a JAR file to authenticate their origin. You can read more about this in our upcoming security trail.
Where to Find Documentation
Currently, the amount of documentation available within the tutorial about JAR files is somewhat limited. However, it's enough to get you going.In addition, to the above-mentioned JAR documentation you can find in the tutorial, the JAR Guide and Manifest Format Specification are available at the JAR - Java Archive page.
- 1.1 Changes: Java Archive (JAR) Files and Appletsshows you how to use JAR files with your applets and talks about the benefits of doing so.
- The beans trail contains the outline for a new lesson we have planned: Packaging Beans for Distribution.
- JAR files are used in a number of the tutorial's applet examples, including: The AroundTheWorld example in Writing Global Programs, and Introduction to the New AWT Event Model.
- And to help you get started, here's a brief introduction to some of the basics of using JAR files.
You create and manipulate JAR files with the
jar
utility program. The command line arguments tojar
are similar to those of the UNIXtar
program. The four most common things you will do with a JAR file are: create a JAR file, list the contents of a JAR file, extract the contents of a JAR file, and use a JAR file in theARCHIVE
attribute of the <APPLET> tag. Briefly, here's how to do each of those things (using Solaris or Windows):
To create a JAR file: jar cvf JARfilename listoffiles
To list the contents of a JAR file: jar tvf JARfilename
To extract the entire contents of a JAR file: jar xvf JARfilename
To specify the use of a JAR file with an applet: <applet code=AppletClassName.class archive="JarFileName.jar" width=width height=height> </applet>
What's New in 1.1? |