JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Packages Object

Name

Packages Object---packages of Java classes

Availability

Navigator 3.0

Synopsis

Packages

Properties

java

A reference to a JavaPackage object that represents the top node of the java.* package hierarchy.

netscape

A reference to a JavaPackage object that represents the top node of the netscape.* package hierarchy.

sun

A reference to a JavaPackage object that represents the top node of the sun.* package hierarchy.

Description

The Packages property is a "global" variable in JavaScript. It is a read-only reference to a JavaPackage object, and is defined as a property of all Window objects. Because the Packages property is the same for all Window objects, you can always refer to it simply as Packages, rather than explicitly accessing it through a particular Window object.

A JavaPackage object in JavaScript is an object that contains references to other JavaPackage objects and to JavaClass objects. Each JavaPackage object represents a node in the tree of package names. The Packages property refers to a JavaPackage object that is the root of this package name hierarchy.

The Packages JavaPackage object contains three properties--java, sun, and netscape--all of which refer to other JavaPackage objects representing the java.*, sun.*, and netscape.* Java packages.

Usage

The Window object also contains "global" properties named java, netscape, and sun, all of which are synonyms for the properties of the Packages object. So instead of writing Packages.java.lang.Math, for example, you can just write java.lang.Math.

See Also

"JavaClass", "JavaObject", "JavaPackage"


Previous Home Next
Option.value Book Index Packages.java

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
This HTML Help has been published using the chm2web software.