Version 24 of JTcl

Updated 2013-07-03 06:16:09 by PZ
What: JTcl
Where: ftp://ftp.gaertner.de/pub/j/jtcl-1.0.tar.gz  
Where: https://kenai.com/projects/jtcl/downloads 
Description: Java script library allowing access to the Tcl language.
        Can invoke Tcl extensions such as Tk, allowing Java programmers
        to create GUI interfaces for Java applications.
Updated: 07/2013
Version: 2.5.0
Contact: mailto: [email protected]

JTcl Interpreter is an implementation of Tcl 8.4 in Java.


JTcl port for Android


MHo 2013-03-01: The tool paraffin.tcl doesn't work for me (Windows XP platform). The command

set jtclJar [ziplib::getClassLocation [java::getinterp]]

gives an unusable filename on windows, with a leading slash '/'. But even working around this, somethings going wrong (did not have the time to look further yet):

c:\Programme\jtcl-2.4.0>jtcl paraffin.tcl iskvprep6 ./iskvprep6 iskvprep6.bat .
could not open file ".\echopath": file is not a zip file
    while executing
"error "could not open file \"$fileName\": file is not a zip file""
    ("if" then script line 2)
    invoked from within
"if {[java::isnull $ent]} {
        error "could not open file \"$fileName\": file is not a zip file"
    }"
    (procedure "ziplib::openInputZip" line 16)
    invoked from within
"ziplib::openInputZip $jar"
    invoked from within
"set jarin [ziplib::openInputZip $jar]"
    ("foreach" body line 5)
    invoked from within
"foreach jar $jars {
        if {! [file isfile $jar]} {
            continue
        }
        set jarin [ziplib::openInputZip $jar]
        ziplib::c..."
    (procedure "mkJar" line 22)
    invoked from within
"mkJar $app $srcdir $start $libdir"
    (procedure "cmdLine" line 32)
    invoked from within
"cmdLine"
    (file "paraffin.tcl" line 79)

TP Could you file a bug report at http://kenai.com/bugzilla/buglist.cgi?product=jtcl ? Please include Java version, and the pathname of your Java installation. MHo: No, I don't, because doing this requires a login/registration. The JRE used was 1.6.0_41.

TP What is the pathname of your Java install? Please attach the output of "parray env" from the JTcl interactive shell. By the way, http://mailinator.com is useful for one-time email addresses :-)

% parray env
env(CLASSPATH)                     = C:\Programme\jtcl-2.4.0\\jtcl-2.4.0.jar;.;C:\Programme\Java\jre1.6.0_07\lib\ext\QTJ
ava.zip
env(HOME)                          = D:\Home\Hoffmann
env(USER)                          = HOFFMANN
env(awt.toolkit)                   = sun.awt.windows.WToolkit
env(file.encoding)                 = Cp1252
env(file.encoding.pkg)             = sun.io
env(file.separator)                = \
env(java.awt.graphicsenv)          = sun.awt.Win32GraphicsEnvironment
env(java.awt.printerjob)           = sun.awt.windows.WPrinterJob
env(java.class.path)               = C:\Programme\jtcl-2.4.0\\jtcl-2.4.0.jar;.;C:\Programme\Java\jre1.6.0_07\lib\ext\QTJ
ava.zip
env(java.class.version)            = 50.0
env(java.endorsed.dirs)            = C:\Programme\Java\jre6\lib\endorsed
env(java.ext.dirs)                 = C:\Programme\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
env(java.home)                     = C:\Programme\Java\jre6
env(java.io.tmpdir)                = d:\var\temp\
env(java.library.path)             = C:\WINDOWS\system32;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Progr
amme\Tcl\bin;C:\Programme\ActiveState Komodo Edit 7\;C:\Programme\caesar\OraClientNet\bin;C:\Programme\caesar\OraClientN
et\;C:\Programme\Python27\;C:\Programme\Python27\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;c:\Prog
ramme\misctool;d:\home\Hoffmann\pgm\tcl\usr\bin;c:\Programme\sysinternals2;C:\Programme\ResKits\Tools\;C:\Programme\Supp
ort Tools\;C:\Programme\Pbx;C:\Programme\Perl\site\bin;C:\Programme\Perl\bin;c:\Programme\Regina;C:\Programme\Lua\5.1;C:
\Programme\Lua\5.1\clibs;C:\Programme\coreutils;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Programme\ooRexx;C:\Progra
mme\Subversion\bin;C:\Programme\Gemeinsame Dateien\Acronis\SnapAPI\;C:\Programme\Citrix\System32\;C:\WINDOWS\system32\Wi
ndowsPowerShell\v1.0;C:\Programme\Citrix\System32\;%APPDATA%\Python\Scripts;c:\programme\unix2;C:\programme\texlive\2011
\bin\win32;c:\programme\mingw\bin;c:\Programme\MinGW\msys\1.0\bin;;.
env(java.runtime.name)             = Java(TM) SE Runtime Environment
env(java.runtime.version)          = 1.6.0_41-b02
env(java.specification.name)       = Java Platform API Specification
env(java.specification.vendor)     = Sun Microsystems Inc.
env(java.specification.version)    = 1.6
env(java.vendor)                   = Sun Microsystems Inc.
env(java.vendor.url)               = http://java.sun.com/
env(java.vendor.url.bug)           = http://java.sun.com/cgi-bin/bugreport.cgi
env(java.version)                  = 1.6.0_41
env(java.vm.info)                  = mixed mode, sharing
env(java.vm.name)                  = Java HotSpot(TM) Client VM
env(java.vm.specification.name)    = Java Virtual Machine Specification
env(java.vm.specification.vendor)  = Sun Microsystems Inc.
env(java.vm.specification.version) = 1.0
env(java.vm.vendor)                = Sun Microsystems Inc.
env(java.vm.version)               = 20.14-b01
env(line.separator)                =

env(os.arch)                       = x86
env(os.name)                       = Windows XP
env(os.version)                    = 5.1
env(path.separator)                = ;
env(sun.arch.data.model)           = 32
env(sun.boot.class.path)           = C:\Programme\Java\jre6\lib\resources.jar;C:\Programme\Java\jre6\lib\rt.jar;C:\Progr
amme\Java\jre6\lib\sunrsasign.jar;C:\Programme\Java\jre6\lib\jsse.jar;C:\Programme\Java\jre6\lib\jce.jar;C:\Programme\Ja
va\jre6\lib\charsets.jar;C:\Programme\Java\jre6\lib\modules\jdk.boot.jar;C:\Programme\Java\jre6\classes
env(sun.boot.library.path)         = C:\Programme\Java\jre6\bin
env(sun.cpu.endian)                = little
env(sun.cpu.isalist)               = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
env(sun.desktop)                   = windows
env(sun.io.unicode.encoding)       = UnicodeLittle
env(sun.java.command)              = tcl.lang.Shell
env(sun.java.launcher)             = SUN_STANDARD
env(sun.jnu.encoding)              = Cp1252
env(sun.management.compiler)       = HotSpot Client Compiler
env(sun.os.patch.level)            = Service Pack 3
env(user.country)                  = DE
env(user.dir)                      = C:\Programme\jtcl-2.4.0
env(user.home)                     = D:\Home\Hoffmann
env(user.language)                 = de
env(user.name)                     = HOFFMANN
env(user.timezone)                 =
env(user.variant)                  =
%

TP I think I might see your problem, look at your command line:

c:\Programme\jtcl-2.4.0>jtcl paraffin.tcl iskvprep6 ./iskvprep6 iskvprep6.bat .

The parameters to paraffin.tcl are app-name source-directory start-file [ jar-directory ]

start-file should be the Tcl file that is your main script, not a batch file. jar-directory should be a directory that only contains the additional jar files you need for your application. You are using "." as the jar-directory, which probably contains files other than jar files. Does your application require additional jar files? If so, place all of those jar files in a clean directory.

See the example at: http://jtcl.kenai.com/docs/paraffin.html for more information.

MHo: iskvprep6.bat is a tcl script. Some scripts that I write allways start this way:

#!/bin/sh
# \
exec /iskv/tools/tclkitsh "$0" ${1+"$@"}
::if 0 {
@cls
@tclkitsh859.exe "%~dpn0.bat" %*
@goto :EOF
}

:
:

And I don't need additional JARs, I think. But of course I will look at the example.

MHo 2013-03-08: Don't know what I made different than before (besides looking at the documentation page which I missed before), but the paraffin step now works ok and produces a .jar file. Running the .jar file gives the following error:

C:\Programme\jtcl-2.4.0>java -jar iskvprep6.jar
could not read "resource:tcl/app/iskvprep6.bat": no such file or directory
    while executing
"file mtime [info script"
    invoked from within
"clock format [file mtime [info script]] -format %d.%m.%Y"
    invoked from within
"puts stderr "
$script - [clock format [file mtime [info script]] -format %d.%m.%Y] - Anlegen von Unix-Gruppen, -Be
nutzern und HomeDirs fuer 21c

Aufru..."
    ("if" then script line 2)
    invoked from within
"if {$argc == 0 || $cIx < 0} {
   puts stderr "
$script - [clock format [file mtime [info script]] -format %d.%m.%Y] -\
Anlegen von Unix-Gruppen, -Benu..."

TP This error is from the file command not understanding the resource: convention. Instead of a true virtual file system (like C/Tcl), JTcl only recognizes resource: in open and source commands. To make this work, you'll have to modify your application to not use file on a resource: pathname.

MHo: Then, how to get the filetime of the script itself?

TP Unfortunately, there's not an easy way. The included package ziplib has a library command to open and traverse a zip or jar file. See the second example at: http://jtcl.kenai.com/docs/jtcllib/ziplib.html Instead of using the getName method, use getTime, which will return the zip entry's modification time in milliseconds.