http://tcljava.sourceforge.net/ is the home of Tcl Blend. Tcl Blend is a Tcl package that provides access to Java classes from Tcl. Tcl Blend is implemented using JNI. Tcl Blend is production ready software, it is stable enough to be used in production systems on a daily basis.
Jacl and TclBlend are both implementations that make it easy to use Tcl scripting on the Java platform. The Tcl/Java project provides mailing lists [3 ], online documentation [2 ], and a bug reporting interface [1 ].
Links to a number of Jacl and Tcl Blend related articles are also available [4 ].
For help building Jacl under Windows, see Building TclBlend with msys_mingw.
During April 2008, an announcement was made that the TclBlend 1.4.1 release was available online at the sf.net project sight..
Ed Hume I've been able to build tclblend 1.4.1 on a 32bit Linux system with "make test" results as follows (all builds using Thread 2.6.5):
|8.4.18||1.6||only one test failure, JavaImportCmd-2.8 but the test commands work if entered|
|interactively so this is likely timing and thread related|
|(there are other test failures that are explained by jdk changes and are not errors)|
Something is very wrong with using Tcl 8.5 and Tclblend - the first tests to fail are related to setting errorCode or errorInfo results in the interpreter, but there are many errors and segfaults. I am hoping someone who is familiar with TclBlend and 8.4 to 8.5 internal changes may shed some light on the subject.
For TIP 330, I also modified src\native\javaInterp.c:
#if TCL_MAJOR_VERSION > 8 || \ (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 5) ckalloc((unsigned) (strlen(Tcl_GetStringResult(interp)) + 1)); #else ckalloc((unsigned) (strlen(interp->result) + 1)); #endif #if TCL_MAJOR_VERSION > 8 || \ (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 5) strcpy(tPtr->errMsg, Tcl_GetStringResult(interp)); #else strcpy(tPtr->errMsg, interp->result); #endif
package require java java::import java.net.InetAddress puts "My IP Address is: [ [ java::call InetAddress getLocalHost ] getHostAddress ] "
Tcl 8.6.0 can execute test script correctly. However, Tcl 8.6.1 or above version fail when TclBlend try to invoke a Java method.
Note: I also test Tcl 8.5.18, can execute test script correctly.
I experienced the same fatal errors .. tclblend worked with Tcl 8.4.x, 8.5.x, 8.6.0 and then stopped working.
Here is even a simpler way to get a crash (with tcl > 8.6.0)
package require java set jObj [java::new java.lang.Object] puts "jObj is $jObj" ;# --> jObj is java0x1 puts "jObj value is [$jObj toString]" ;# --> jobj value is [email protected] (CRASH with TCL > 8.6.0)
I may be wrong, but my guess is that Tcl 8.6.1 introduced a major change with the Non-Recursive Engine (it was not present in (8.6beta)), so all the intricated (to me) stuff about the reference-counting should be reviewed ... WRONG !! NRE was in 8.6beta and 8.6.0
It's a pity; I have a 'stubbed' tclblend that can work from Tcl 8.4 to Tcl 8.6.0 . I know that 'stubbed' TclBlend can be used only in one way (from Tcl to Java and not in the opposite direction), and this worked perfectly for calling complex Java packages (itextPdf, BouncyCastle crypto, ...) .. up to Tcl 8.6.0.
Up to now, my only solution is to distribute my apps with an old TclKit support. Does anyone knows some alternatives for connecting a Tcl interpreter to a JavaMachine ( .. I don't need the opposite direction) ?
I submitted a bug (with a fix proposal) to the Tcl-core
See https://core.tcl.tk/tcl/tktview?name=07d13d99b0 for details.
I believe that the crash is due to a change in tclObj.c introduced in 8.6.1. My patched Tcl-8.6.1 (.. 8.6.4) seems to work but of course changes in Tcl-core require a lot of attention.
ABU 9-08-2016 * Restored support for TclBlend.
Tcl 8.6.6, released on late July 2016, restored support for tclblend. Great !