Package Manager Samples

These samples are located in \Samples\Packaging\Pkgmgmt.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

The primary function of the Java Package Manager (JPM), which is part of the Microsoft virtual machine, is to find classes when they are requested. When a class is requested, the JPM determines what package the class is in, and then refers to an internal database to determine where the package is stored. For more information on JPM, see the Microsoft SDK for Java documentation.

You must have Microsoft® Internet Explorer 4.0 or later installed to run the JPM samples.

The following samples show how to use JPM.

Using the Samples

Application Installation Sample (Mapplet)

To compile the sample

You do not have to use nmake before running this sample, because this sample uses a signed cabinet file (.cab) already created using the dubuild command. If you rebuild the .cab file using these commands, you must also run setreg 1 true to enable the test root. This allows test certificates to run properly on your system. For more information, see the Microsoft SDK for Java documentation. The following commands, which are in a makefile in the mapplet subdirectory, are used to build this sample:

dubuild Mapplet.cab . /D "Mapplet" /N "Mapplet" /I *.class /V 1,0,0,0
makecert -sk MyKeyName -n "CN=Microsoft Corporation" MyTestCert.cer
cert2spc MyTestCert.cer MyTestCert.spc
signcode -j javasign.dll -jp low -spc MyTestCert.spc -k MyKeyName Mapplet.cab 

To install the sample

The following button opens pkgmgmt_mapplet_app.htm that contains an applet to install the sample. A security dialog box will appear. If you click yes, the page will display a box with the text "Application Installed." You can see the application installed as "Mapplet" in your %Windir%\Downloaded Program Files directory.

To run the sample

Use the following command to run the Mapplet application:

jview -N "Mapplet" MApplet

This command tells jview to run the class MApplet from the application namespace Mapplet.

Signed Applet Installation Sample (Notepad)

To compile the sample

You don't have to use nmake before running this sample, because this sample uses a signed cabinet file (.cab) already created using the dubuild command. If you rebuild the .cab file using these commands, you must also run setreg 1 true to enable the test root. This allows test certificates to run properly on your system. For more information, see the Microsoft SDK for Java documentation. The following commands, which are in a makefile in the notepad subdirectory, are used to build this sample:

dubuild notepad.cab . /D "MiniNotepadApplet" /I *.class /V 1,1,23,1
makecert -sk MyKeyName -n "CN=Microsoft Corporation" MyTestCert.cer
cert2spc MyTestCert.cer MyTestCert.spc
signcode -j javasign.dll -jp low -spc MyTestCert.spc -k MyKeyName notepad.cab 

To install and run the sample

The following button opens pkgmgmt_notepad_app.htm, which installs and runs a signed applet. During installation, a security dialog box appears. If you accept the applet, it is stored along with its certificate in the package manager. This means that you won't be queried about the applet again until an update appears.

Because this mini-notepad applet is signed, you can use it to read files from your local hard disk. To open a file, on the File menu, select Open.

Key Project Files

Application Installation Sample (Mapplet)

makefile

This batch file contains the commands to package Java classes into a cabinet file so that they can be installed using a Web browser.

pkgmgmt_mapplet_app.htm

This HTML file installs the class files contained in the cabinet.

Signed Applet Installation Sample (Notepad)

makefile

This batch file contains the commands to package Java classes into a cabinet file so that they can be installed as signed classes.

pkgmgmt_notepad_app.htm

This HTML file installs and runs the classes as a signed applet.

Technologies Demonstrated

Package Manager

This sample shows how to:

HTML Scripting

Building Cabinet files

Security

This sample shows how to:

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