This sample is located in \Samples\Packaging\Create.
Description
Using the Sample
Key Project Files
Technologies Demonstrated
This sample provides a tool for creating cabinet (.cab) files. The tool includes options for choosing a compression mode and for recursing into subdirectories when creating the cabinet.
To compile the sample
Use Nmake.exe to compile the makefile in the \Samples\Packaging\Create directory.
To use the sample
Use the following command to run the create tool:
jview Create [options] <cabinet file> <input files>
The command-line arguments are as follows.
options | Two options are available:
/m <mode> Specifies the compression mode. It can be NONE, MSZIP, or LZX:n, where n is between 15 and 21 inclusive. The LZX compression mode is supported by Microsoft® Internet Explorer 4.0 or later. The default compression mode is MSZIP. /r Archives files recursively in all subdirectories. |
cabinet file | Name of the cabinet file to be created. |
input files | Names of the files to archived in the cabinet file. |
To test the create tool, use the following command to create a cabinet (archiving the file Create.java):
jview Create /m MSZIP test.cab Create.java
The created cabinet file, test.cab, can be extracted using the Extract utility found in the \Samples\Packaging\Extract directory. Note that this sample does not preserve the date and time of files added to a cabinet file.
To display help on the create tool, use the following command:
jview Create
This class processes user input and determines what action to take (display Help, create a cabinet file). The code passes a CabMaker object to the CabCreator class when creating a cabinet file. This file also contains the code for displaying Help on the create tool.
CabMaker.javaThis class creates the cabinet file.