Java Beans   «Prev 

Wildcards in the JAR utility command line

Using the (JAR) utility to examine JAR files and package Beans

You can use more than one wildcard in the JAR utility command line.
For example, to include all
  1. the classes,
  2. GIF images, and
  3. AU sounds in the current directory,

you would provide the following wildcards:
*.class *.gif *.au.


The jar utility in Java can use several wildcards when packaging beans:
  1. (asterisk): This wildcard represents any number of characters. For example, to include all files in a directory that start with "Bean" and have a ".class" extension, you can use the following command: jar cvf myBean.jar Bean*.class
  2. ? (question mark): This wildcard represents a single character. For example, to include all files in a directory that start with "Bean" and have a three-character extension, you can use the following command: jar cvf myBean.jar Bean???.*
  3. ** (double asterisk): This wildcard represents any number of subdirectories. For example, to include all files in a directory and its subdirectories that start with "Bean" and have a ".class" extension, you can use the following command: jar cvf myBean.jar **/Bean*.class

Note that the double asterisk wildcard was introduced in Java 7 and is not available in earlier versions of Java.

Using JAR Files with HTML

Since JAR files allow us to package a collection of files into one, and to compress the archive, they offer the opportunity to improve the download performance of applets that are retrieved from the Web via HTTP transactions. Basically, we can download the entire archive file in a single HTTP transaction. This reduces the number of trips we must make over the network to get all of the classes and associated files needed for an applet. Without an archive, multiple HTTP transactions may be required to download the required class files. There is also a performance boost because the archive can be compressed, reducing the download time.