+

Search Tips   |   Advanced Search

Instantiating a Java class

We can call external Java classes ; that is, those you have added to the Security Directory Integrator runtime environment, or the CLASSPATH, using script code.

For example, assuming you want to use the standard java.io.FileReader, use the following script:

var javafile = new java.io.FileReader( "myfile" );

You now have an object called javafile; using it we can call all of the methods of the object.

The same technique is used to instantiate our own objects:

var myfile = new my.FileReader("myfile");


Parent topic:

Java + Script ≠ JavaScript