Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 3728ff00d2930b6add4240a6383264ca > files > 65

jacl-manual-1.4.1-5.mga5.noarch.rpm

<HTML>
<TITLE>
Java Package
</TITLE>

<BODY>
<HR>
<H3>
Java Package
</H3>

<HR>


<DL>

<H3>
Loading into Tcl interpreter:
</H3>

<DD>

<b>package require java ?version?</b>

<P>
<B>package require java</B> loads the <B>java</B> package into the
interpreter. The <B>java</B> package provides an interface for creating and
manipulating Java objects via <I>object handles</I>. 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.

<P>

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

<P>

When the <B>java</B> package is loaded into a Tcl interpreter (Tcl Blend),
a JVM will be created in Tcl's process space.

<P>

When the <B>java</B> package is loaded into Jacl, each of the <b>java</b>
commands will be created inside the Jacl interpreter.

<P>


When a JDK 1.2 JVM is created by Tcl Blend, the global variable
<B>tclblend_init</B> is read and each list element is passed as
an option to the Java Virtual Machine.
<p>
Example values include:<br>
<B>-Djava.compiler=NONE </B><br>
disable Just In Time Compiler<br>
<B>-Djava.library.path=c:&#92jdk&#92lib&#92tools.jar</B><br>
set native library path on a Windows system<br>
<B>-verbose:jni</B><br>
print debugging messages<br>
<P>

For <B>-verbose</B>, the value should be a string with one or
more comma separated names (i.e. <B>class,jni</B>).  In JDK1.2
the standard names are:
	 <B>class</B>, <B>gc</B>, <B>jni</B>
To see what other options are available, run <B>java -help</B>
from the command line.
 <p>
In addition <B>tclblend_init</B> can have the following values:
<p>
<B>help</B><br>
Print a help message and then stop JVM initialization.<br>
<B>debug</B><br>
Print out debugging messages when the package is loaded.<br>
<p>
To use <B>tclblend_init</B>, set it before loading the <B>java</B>
package:

<code>
<pre>
set tclblend_init -verbose:jni
package require java
</pre>
</code>

Note that <B>tclblend_init</B> is read only if the Tcl Blend C shared
library was compiled with JDK1.2.  

<P>

</DL>

<DL>

<H3>
Loading into Java:
</H3>

<DD>

<P>

Tcl Blend can now be loaded into an existing JVM. When an
instance of the <B>tcl.lang.Interp</B> class is created
from Java, the shared libraries for both Tcl and Tcl Blend
will be loaded into the JVM's process. All that is
required is to make sure that the system shared library
paths are set properly and that both tclblend.jar and
tcljava.jar appear on the classpath. This exciting new
functionality was one of the most commonly requested
features. Supporting it required re-implementation of
most of Tcl Blend, so we hope you enjoy it.

</DL>

<PRE>
<A HREF="../license.html">Copyright</A> &#169; 1997-1998 Sun Microsystems, Inc.
</PRE>


</BODY>
</HTML>