Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Mo DeJong: New release of Tcl/Java integration tools

Jun 12, 2000, 19:11 (0 Talkback[s])
(Other stories by Mo DeJong)

[ Thanks to Mo DeJong for this announcement: ]

I thought Linux today readers might like to know about the new 1.2.6 release of the Tcl/Java integration tools. The Tcl/Java project combines powerful Tcl scripting with Java. The stable release can be found at http://www.scriptics.com/java. The source code is distributed under a BSD style license, so you are free to use it for anything you like.

There are two implementations of the Tcl/Java API. The first is called Tcl Blend, it provides access to a JVM from inside a Tcl interpreter using JNI. The second implementation is called Jacl, it is a Tcl interpreter written entirely in Java. These two implementations provide the flexibility needed to make scripting work in just about any situation.

For instance, if you have an existing C based application that you would like to add Java support to, you could torture yourself by trying to learn JNI, or you could just load Tcl Blend and Java and start working on your application instead of the terror that is JNI.

If you have a Java application that you would like to extend with a scripting language, you could use Jacl. Jacl is written in Java, so it is very easy to incorporate into an existing Java application. You just add the .jar files to your CLASSPATH and it is up and running!

Both of these implementation also provide a great way to regression test a Java application. Here is a quick example that dynamically allocates a Java string in Tcl code and then calls the charAt() method of the String class to make sure it returns the letter J.

test 1.1 {make sure the java.lang.String.charAt() method works} {
set s [java::new String "I am a Java String"]
$s charAt 7
} J

Since this is an interpreted scripting language, you don't need to compile anything! You just start up the interpreter, paste your code into the shell, and presto you are calling methods on Java objects.

cheers
Mo DeJong
Red Hat Inc