Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

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

The chregclass tool included with Sun Chili!Soft ASP 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 Sun 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 Sun Chili!Soft ASP installation directory.

2.   Stop the ASP Server, as described in "Stopping and Restarting the ASP Server" in "Chapter 3: Managing Sun 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 Sun 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 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.