TCL – trying to execute proc in parallel but getting an odd Java error

I'm following the example from here But when I run a simple code like this I get an error: child process exited abnormally and the error is "Error: Could not find or load main class Caused by: java.lang.ClassNotFoundException:"

    for {set i 0} {$i < 5} {incr i} {
        set script {            
            puts hello
        set chan [open |[list [info nameofexecutable] <<$script 2>@stderr]]     
        dict set res $chan command $script
        fconfigure $chan -blocking 0
        lappend background $chan
    while 1 {
        foreach chan $background {
            if {[eof $chan]} {
                fconfigure $chan -blocking 1
                if {[set idx [lsearch -exact $background $chan]] >= 0} {
                    set background [lreplace $background $idx $idx]
                catch [close $chan] cres copts
                dict set res $chan result $cres
                dict set res $chan options $copts
            } else {
                puts -nonewline [read $chan]
        if {[llength $background] == 0} {
        after 100
    return $res


I get a similar message when trying to run parallel processes in a slightly different way by running this execute statement in a forloop

exec [info nameofexecutable] $variable_of_path_to_script << [list proc_name $param1 $param2] 2>@stderr

Read more here:

Content Attribution

This content was originally published by James Dean at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: