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


Accessing a Java Class via Chili!Beans

You can use the Chili!Beans object Construct method to create instances of Chili!Beans. The first argument is the fully qualified name of the class to be instantiated, and the remaining arguments are the arguments to be passed to the desired constructor for that class. For example, if the package Database contains Table .class, the following script will create a Table object:

Set factory = Server.CreateObject("Chili.Beans")

set table = factory.Construct "Database/Table", "Employees", CLng(100)

This will create an object named "table," using the constructor whose signature is

constructor(String, Int)

If the class name cannot be found on the CLASSPATH or if there is no public constructor whose signature matches the arguments passed to Construct, a run-time error occurs in the client script.

To use a Java class with Sun Chili!Soft ASP, the .class file must exist in a directory that is listed in the Java CLASSPATH environment variable, or it must be registered with Sun Chili!Soft ASP as described in "Registering a Java Class as a COM Component on Linux and UNIX" in this chapter.

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