JavaClass object (Object/Navigator)

A JavaScript data type that encapsulates a Java Class.


JavaScript - 1.1
Netscape - 3.0
JavaScript syntax:NmyJavaClass =

The static fields of the Java Class are presented as properties of the JavaClass object.

The static methods of the Java Class are presented as methods available to the JavaClass object. They may be presented as JavaMethod objects depending on how you access them from JavaScript.

The only properties and methods this object has, correspond to the public properties and methods of the Java class that it represents. You can enumerate these properties in a loop.

Java classes are either stored in individual class files or are collected together into groups stored in a ZIP file. Groups of classes will be represented by a JavaPackage object. Each individual class is represented by a JavaClass object. The JavaClass objects belong to a parent JavaPackage object.

To operate on these objects, you really need to know something about the Java classes they encapsulate. There are many standard classes and some that may have been custom written for your project.

Example code:

   // Create a JavaScript object that encapsulates a Java Class
   var myJavaDateClass  =;
   var myJavaDateObject = new;
   // Write the date to a web page
   // Write the same date value date to the Java console

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


O'Reilly JavaScript Definitive Guide - page - 358