Using the ASP Java Component Framework Classes and Samples

The framework has been provided in both source code (*.java) and compiled bytecode (*.class) formats. To use the classes, you must put them in the directory where the Microsoft virtual machine (Microsoft VM) expects to find them.

To set up the Framework classes

  1. Create a new directory named aspcomp in your java\TrustLib directory. This directory is usually found in the %WINDIR% folder. Because the framework files have been created in a package called aspcomp, the Microsoft VM will expect to find them there.

  2. Copy the framework files to the newly created java\TrustLib\aspcomp directory.

Creating Components

Building a component in Java means creating a single Java class that you will instantiate from ASP as a COM object. This class is called the component class. It is possible that the component will create other Java objects or COM objects, which it uses internally. So, while the source code for your component might consist of multiple Java source files, there will be a single Java class that represents your component.

Creating components with the ASP Java Component Framework is easy.

To create a component

  1. Create the *.java files for your component. Make sure that you include the import aspcomp statement in your source.

  2. Compile the source files to produce *.class files.

  3. Register your component’s Java class with COM so that it can be created (with COM) from an ASP. You do this by running the javareg.exe tool that comes with the Microsoft SDK for Java.

    Note   You only need to register the class once and you only need to register the class that is your component.

The following command shows how to register a component:

javareg /register /class:[<packagename>.]<classname> /progid:<progid>

For more information on registering a Java component, see the description of javareg in the Tools Reference section of the Microsoft SDK for Java documentation. You can also type javareg /? at the command prompt to see a list of the javareg command options.

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