Version 21 of Java and Tcl

Updated 2007-12-14 22:09:21 by dkf

Java and Tcl do actually work together, and can be combined in interesting and useful ways. To get a more complete list of references, go to the Category Java page, click on the title, and you'll get a list of pages that refer to the Java Category.


The most notable combinations of Tcl and Java are described as part of the TclJava project.

  • Jacl is a Tcl 8.x interpreter written in Java. You can script your Java applications in Tcl.
  • TclBlend is an extension that allows you to code new Tcl extensions in Java.
  • Swank is a graphical toolkit for Jacl, allowing Java programs to code against the Tk widget set.

How to Install and Use Jacl, TclBlend, and Swank

You will need a JRE (Java Runtime Environment) to run any of these. The JRE is a free download from Sun, at http://java.sun.com/j2se/

The easiest way to try out any of these projects is to make sure you have a JRE version 1.4.2 or higher, download Swank, and follow the instructions in the README.txt. The download from the Swank site is prebuilt class files, and also includes the prebuilt class files for Jacl and TclBlend.

The downloads from the Jacl and TclBlend sites are the Java source for these projects. You will need a JDK (also free from Sun) to build the "binaries" (Java bytecode classes) from this source. If you are using JDK 1.5 to build version 1.3.1 of Jacl or TclBlend, then before running make, you will need to edit the makefile and add "-source 1.4" to the JAVAC_FLAGS setting: e.g.

 JAVAC_FLAGS = -g -source 1.4

The source for Swank is available from CVS.

To use TclBlend, you also need to download the source for Tcl (and any other extensions you need), configure Tcl to build it for threads, and the build and install it in a new directory. Then, configure and build extensions similarly. Note that not all extensions may be thread safe - alas, I don't know of a way to determine other than trying things out and seeing if they crash.


If you want see contrasts and comparisons between Java and Tcl, then you might want to look at Java vs Tcl or just the Java page.