Oracle8i Java Developer's Guide Release 3 (8.1.7) Part Number A83728-01 |
Library | Service | Contents | Index

## Execution Control

In Sun Microsystems's JDK environment, you develop Java applications with a `main()` method, which is called by the interpreter when the class is run. The `main()` method is invoked when you execute `java` `<`classname`>` on the command-line. This command starts the java interpreter and passes the desired classname to be executed to the interpreter. The java interpreter loads the class and starts the execution by invoking `main()`. However, Java applications within the database do not start their execution from a `main()` method.

After loading your Java application within the database (see "Loading Classes"), you can execute your Java code by invoking any static method within the loaded class. The class or methods must be published for you to execute them (see "Publishing"). Your only entry point is no longer always assumed to be `main()`. Instead, when you execute your Java application, you specify a method name within the loaded class as your entry point.

For example, in a normal Java environment, you would start up the Java object on the server by executing the following:

    java myprogram

where `myprogram` is the name of a class that contains a `main()` method. In `myprogram`, `main()` immediately calls `mymethod` for processing incoming information.

In Oracle8i, you load the `myprogram.class` file into the database and publish `mymethod` as an entry-point. Then, the client or trigger can invoke `mymethod` explicitly.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index