Aolserver nsjava Module Tcl API Reference -- ns_java command

### ns_java

#### Overview

Call an arbitrary java static method from tcl.

#### Syntax

ns_java ?-detach?classname::methodname ?arg1? ?arg2? ?...?

#### Description

This function calls the named java static method from within either a tcl or an adp page. The arguments are packed together as a java string array and handed to the called function as a single argument. Only the calling of methods that return void are currently supported, but this will change in future releases.

Optional -detach flag is used to tell nsjava to detach the current jvm thread. This is needed as a workaround for scheduled procs to ensure that the jvm threads are detached when done.

The classname is the java class that contains the static method to be called, and this class must reside somewhere on the classpath set in the nsd.tcl startup file. See the nsjava installation docs for more details.

The methodname is the java static method to be called. It can accept zero or one java.lang.String[] arguments and it must have a return type of void.

You can pass any number of arguments (arg1,arg2,arg3...) to ns_java from within tcl and they will be packed into a single java.lang.String array and passed to the static method..

Copyright © 2000 Daniel Wickstrom.