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;
Prev | Home | Next |
Packages | Up | Packages.netscape |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |