The java::load Command


java::load ?-classpath pathList? extensionName

The java::load command loads extensions into the Java VM. An extension is a Java class that specifies a set of class files to load into the VM, as well as specifying how the Tcl interpreter should interact with these classes. The primary use for this function is to load new Tcl commands into the interpreter, but it may also be used to load classes into the VM that can be used by the Reflection API.

The argument extensionName is the name of the class file to load into the VM. The class referenced by extensionName must be a subclass of tcl.lang.Extension. All subclasses of Extension must implement the abstract init method, which is responsible for loading commands into the Tcl interpreter or loading any additional classes into the java VM. To load classes that do not subclass Extension into the VM, use the java::new, java::class or java::defineclass commands.


Load an extension stored in /home/user/Foo.class;

java::load -classpath /home/user Foo


Currently '~' substitution is not performed on Unix systems. The path must be absolute or relative from the current directory.

Copyright © 1997-1998 Sun Microsystems, Inc.