Importing Java Classes to ECMAScript with the import Statement

You can use the import statement to specify Java classes that you may use in ECMAScript. The import statement works in a manner very similar to the Java import directive, except that you may not use the * operator to specify all the classes within a given package.

Classes you reference with import may be qualified by their package name or by their path within the current project. In the following examples, the first imports the ArrayList class, a popular Java class used to create lists of items for iterative access. The second imports Contact, an internal class defined in the ConsolidateAddress.jws web service file, a sample web service available with WebLogic Workshop.

import java.util.ArrayList;
import xmlmap.ConsolidateAddress.Contact;

For more information about the Java import directive, see Importing Packages in Introduction to Java.

Related Topics

Introduction to Java