ABU 17-sep-2019 - released ver 2.1
tclJBlend (aka "Tcl-J-Blend" or "JBlend") is a new fork of TclBlend (See http://tcljava.sourceforge.net/ ), a Tcl extension that uses JNI to communicate with a Java interpreter.
The main goal of JBlend is to provide the same TclBlend command interface, with a single multiplatform package that can be installed and run on all the most popular platforms (Windows, Linux, MacOS), independently of the JVM installed on the target computer.
This means that - with no need of rebuild - you can install/copy JBlend on Win/Linux/Mac, and moreover, once installed, you are also free to change/upgrade the underlyng Tcl or JVM - again, with no need to rebuild JBlend .
To achieve this goal JBlend lost the TclBlend/Tcljava ability to act as a bidirectional bridge between a JVM and a Tcl interpreter; JBlend can be used only in one way, from Tcl to Java and not in the opposite direction. For many Tcl users like me, this is enough.
Changing the true nature of TclBlend/Tcljava, required radical changes over the original TclBlend code, not to mention the completely redesigned build procedures; hence the need of a fork: JBlend .
-
Prebuilt binary packages for Windows/Linux/MacOS are available at Sourceforge .
You can choose among an universal package (for Win/Mac/Linux) requiring an external JavaRuntimeEnvironment or a package for a specific platform bundled with an embedded JRE (OpenJDK).
You can also download the JBlend development kit (only for developers/maintaners)
What you need:
Starting from JBlend 2.1 there is no need to set the LD_LIBRARY_PATH environment variable.
Now you are ready to run ..
type the following Tcl commands
# Uncomment and adapt the following line if JBlend is not placed in a directory # referenced by the auto_path variable. # # lappend auto_path ...where-is-JBlend... # package require JBlend # create a Java object ( a java.lang.String ) set x [java::new java.lang.String "Hello Tcl ! I'm a Java String"] # call the "toUpperCase" java-method set res [$x toUpperCase] puts $res ....
ABU Please note that JBlend for Android comes with its own source/binary distribution.
No special precautions are needed since the runtime environment already has something like a JVM running when tclJBlend is loaded.
The same Tcl commands as in the previous examples can be used to make an upper case representation of a java.lang.String.
Note: the Java environment on Android does not fully support JavaBeans, thus Bean related functions of tclJBlend are not supported. Class loading seems to be different, too, and needs further investigation. As of 2019-02-25, support for tclJBlend in AndroWish is available in the source tree, but still WIP and thus to be considered alpha quality.
Download the JBlend Development-Kit [L1 ], or better download the last version from the SourceForge SVN repository [L2 ]
Detailed instructions are within the bundled documentation. Here, just few quick notes:
On windows
cd ...\tclJBlend-devkit ms-build x32 ms-build x64
On Unix (Linux/Mac or Windows+MingW)
cd .../tclJBlend-devkit ./build.sh x32 ./build.sh x64
By default intermediate results will be saved under the XBUILD subdirectory; XBUILD/tclJBlend contains the deliverable package. (If you use a shared disk for building, you can attach it to Win/Linux/Mac so that XBUILD/tclJBlend will collect all the native DLL/.so/.dylib so far built).
If you need to build a JBlend+JVM bundle, read the detailed instruction in tclJBlend-devkit/HowTO-AssembleJBlend+JVM.txt