JavaPackage object (Object/Navigator)

A JavaScript data type that encapsulates a Java Package.


JavaScript - 1.2
Netscape - 4.0
JavaScript syntax:NmyJavaPackage = myWindow.Packages

A collection of Java classes are represented as a package. The complete set of all available Java Packages are contained within a single parent JavaPackage object. This constructs a hierarchy of JavaPackage and JavaClass objects.

The properties of the JavaPackage object are those that refer to any Java Class or Java Packages that belong to it. However, these are generally not enumerable so you do need to know what they are called before you can access them.

Because you cannot enumerate the properties of this object you won't be able to walk a Java package hierarchy with a script-driven tree walker.

The JavaPackage tree structure resembles the directory structure that the Java class files are stored in. Some class files are collected into ZIP archives but even then the hierarchy is still intact and there will be one package that represents the ZIP file and corresponds to that node in the tree. Any arbitrary collection of classes will be represented by a JavaPackage object, regardless of how they are stored in the file system.

Example code:

   // Create a JavaScript object that encapsulates a Java Package
   var myJavaPackage =;

See also:JavaScript to Java values, LiveConnect, netscape.applet,, Packages.netscape,, Window.Packages, Window.sun