Java Package


About:

package require java ?version?

package require java loads the java package into the interpreter. The java package provides an interface for creating and manipulating Java objects via object handles. Object handles are references to Java objects in Tcl. Many of the commands in the java package take arguments and return values that are object handles.

Before you can use the java commands you must load the java package by executing a package require java command.

When the java package is loaded into Tcl Blend, Tcl will create a JVM in Tcl's process space.

When the java package is loaded into Jacl, each of the java commands will be created inside the Jacl interpreter.

When a JDK 1.2 JVM is created by Tcl Blend, the global variable tclblend_init is read and passed to the Java Virtual Machine. Example values include:

-Djava.compiler=NONE
disable Just In Time Compiler
-Djava.library.path=c:\jdk\lib\tools.jar
set native library path on a Windows system
-verbose:jni
print debugging messages

For -verbose, the value should be a string with one or more comma separated names (i.e. class,jni). In JDK1.2 the standard names are: class, gc, jni To see what other options are available, run java -help from the command line.

In addition tclblend_init can have the following values:

help
Print a help message and then stop JVM initialization.
debug
Print out debugging messages while start up.
To use tclblend_init, set it before loading the java package:
set tclblend_init -verbose:jni
package require java
Note that tclblend_init is only read if the Tcl Blend C shared library was compiled with JDK1.2.

Copyright © 1997-1998 Sun Microsystems, Inc.