Microsoft SDK for Java

Packaging a Java Library with Dubuild

The following tutorial shows how to install a set of Java libraries into the Microsoft virtual machine using a distribution unit created with the dubuild utility. The tutorial uses JPMBrowser as the example package.

To create and distribute DUs

  1. Decide on a package name.

  2. Create the DU with the dubuild utility.

  3. Test install the DU with an HTML page.

Decide on a Package Name

You should choose a meaningful and descriptive name for your package and use the com.company.packagename naming convention. The JPMBrowser example is a Microsoft library for Java so it uses the com.ms. prefix. The resulting package name is com.ms.JPMBrowser.

Make sure your directory structure reflects the package name. In the JPMBrowser example below, the working directory that contains the .class files is C:\projects\JPMBrowser\com\ms\JPMBrowser.

Create the Distribution Unit

  1. From a DOS prompt, change your working directory to the top-level project directory. For this example, it is C:\projects\JPMBrowser:
    C:\>cd \projects\JPMBrowser
    
  2. Run the dubuild utility, found in the %SDKDIR%\Bin directory:
    C:\..\JPMBrowser>dubuild jpm.cab . /D "JPM Browser" /I *.class /V 1,1,23,0
    

    In this command, the /D option specifies a friendly name for the DU, the /I option specifies that only Java class files are included, and the /V option specifies the version number.

  3. Run extract /D to view the resulting cabinet file and to verify that the proper files are included with the correct directory paths:
    C:\projects\JPMBrowser>extract /D jpm.cab
    Microsoft (R) Diamond Extraction Tool - version (16) 1.00.0530 (04/3/95)
    Copyright (c) Microsoft Corp 1994-1995. All rights reserved.
    
     Cabinet jpm.cab
    
    07-30-1997  5:50:32p ----    295 JPM Browser.osd
    07-20-1997  6:38:42p A---  1,960 com\ms\JPMBrowser\JPMPanel.class
    07-20-1997  6:38:42p A---    678 com\ms\JPMBrowser\BrowserFrame.class
    07-20-1997  6:38:42p A---  1,289 com\ms\JPMBrowser\BrowserApplet.class
                     4 Files   4,222 bytes
    

The Open Software Distribution (OSD) file that is packaged with the DU is automatically generated by the dubuild utility. The OSD file contains a list of the included Java packages and sets the version number to be 1.1.23.0. Note that when specifying version numbers on the command line, the version number must be comma-separated.

Make sure that your packages are in the appropriate (in this case, com\ms\JPMBrowser) subdirectory, as shown above.

Test Install the DU with an HTML Page

To test the installation of the DU, write an HTML page that installs and runs the application or applet. The HTML for the JPMBrowser sample applet uses an <APPLET> tag and several special useslibrary parameters. These parameters specify the friendly name, location, and version of the DU as shown in the example below. For more information on the <APPLET> tag and associated parameters, see HTML Tags to Install DUs.

<APPLET 
  code=com.ms.JPMBrowser.BrowserApplet
  width=200
  height=200>
<PARAM NAME=useslibrary VALUE="JPM Browser">
<PARAM NAME=useslibrarycodebase VALUE="jpm.cab">
<PARAM NAME=useslibraryversion VALUE="1,1,23,0">
</APPLET>

You can place this applet in an HTML file that is in the same directory as your cabinet file, or you can specify a remote location for the cabinet file in the useslibrarycodebase parameter. To test the installation, browse the HTML page in Microsoft® Internet Explorer. It should install the cabinet file and show the applet on the page.

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