image\cslogo3d1.gif

Registering a Java Class as a COM Component on Linux and UNIX

The chregclass tool included with Chili!Soft ASP 3.6 enables you to register a Java class as a COM component on Linux and UNIX. You register a Java class by using the chregclass tool to create a registry entry that maps a given ProgID to the Java class. The chregclass tool is similar to the javareg tool provided for the Microsoft JVM.

Notes

In order to register a Java class to use with Chili!Soft ASP, the .class file must exist in a directory that is listed in the Java CLASSPATH environment variable.

Any class registered by using chregclass must have a public default constructor to instantiate the class. This applies to all chregclass calls.

To register a Java class as a COM component

1.   Log in as root and change directories to the Chili!Soft ASP 3.6 installation directory.

2.   Stop the ASP Server, as described in "Stopping and Restarting the ASP Server" in "Chapter 3: Managing Chili!Soft ASP."

3.   Map the ProgID to the Java class by running the following command:

chregclass [–f] [ProgID] [JAVA_CLASS]

where [ProgID] is the Prog ID you want to map and [JAVA_CLASS] is the name of the Java class you want to register. [JAVA_CLASS] should not include the .class extension. If it does, the mapping will not work.

4.   Restart the ASP Server, as described in "Stopping and Restarting the ASP Server" in "Chapter 3: Managing Chili!Soft ASP."

For example, to register the Table .class in the package Database on the CLASSPATH, use the following command:

chregclass Db.Table Database/Table

After running this command, you can then construct a Table object in a client script as follows:

set table = Server.CreateObject("Db.Table")

Copyright 2001 Sun Microsystems, Inc. All rights reserved. Legal Notice.