Packages.java (Java package)

A package containing a collection of generic Java classes maintained as a package.

Availability:

JavaScript - 1.1
Netscape - 3.0
Opera - 3.0

An example of a Package reference is the Java Date class stored in the java.util package.

To access this from JavaScript you would use this kind of construction:

myJavaClass = Packages.java.util.Date;

That mode of access would yield a reference to the Class and would produce a JavaClass object in the JavaScript environment. To create an instance and yield an object of that class, use the class as a constructor. Like this:

myJavaObject = new Packages.java.util.Date;

That would create a JavaObject object in the JavaScript environment.

If necessary, you may want to access a collection of Classes which is called a Package. Here is how to create a JavaScript environment's JavaPackage object:

myJavaPackage = Packages.java.util;

See also:JavaClass object, JavaObject object, JavaPackage object, Window.java