Microsoft SDK for Java

Building Cabinet Files for Libraries

To create a cabinet file to install Java libraries on a user's computer

  1. Ensure that the %SDKDIR%\Bin directory, which contains Cabarc.exe, is in your path.

  2. Run Cabarc.exe to build the inner cabinet that contains all your class files. For command-line syntax for this tool, see the cabarc section of the Tools Reference. It is a good idea to put your vendor name as the package name preceding all your classes to avoid having them overwritten by other installed classes. That is, your classes should be in the form suggested by the following example (where "vendor" is your unique vendor name):
    vendor.util.loader.class
    vendor.util.builder.class
    vendor.applet.start.class
    

    For example, your company is called MyCompany. You have a package called widgets located on your development computer at C:\JavaCode\MyCompany\Widgets\*.class. You want to install this package in the user's %Windir%\Java\Lib directory. You would change to the directory C:\JavaCode\ and run cabarc as follows.

    cabarc -r -p -P javacode\ n MyClasses.cab MyCompany\*.*
    

    In this syntax, -r tells cabarc to recursively archive everything under MyCompany, maintain the directory structure (-p), strip javacode from the directories (-P javacode\), and create a cabinet file called MyClasses.cab.

    When the package is installed on the user's system, all classes will be placed under the %Windir%\Java\Lib unless the .inf file is modified to place them in the TrustLib directory.

  3. Create a .inf file from the Master.inf template in the %SDKDIR%\Readmes directory as described in Creating a .INF File. This file sets up the layout and instructions for installing the libraries. The Master.inf file is heavily commented and includes placeholders for required information.

  4. Run Cabarc.exe again to build the outer cabinet file that contains the class cabinet, the .inf file, and any other files you might want to include. The following example creates an outer cabinet file called OuterCab.cab, which includes the Sample.inf and the MyClasses.cab files:
    cabarc  n OuterCab.cab MyClasses.cab Sample.inf     
    
  5. Optionally, digitally sign the cabinet file.

    Code-signing is important for users so they know to trust your code before placing it on their computers. The default settings in Microsoft® Internet Explorer will reject unsigned code. For more information on trusted code, see Guidelines for Making Java Code Trusted. For information and instructions on signing your code, see the Signing a Cabinet File with Java Permissions and http://msdn.microsoft.com/workshop/default.asp This link takes you to a site on microsoft.com.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.