Forum OpenACS Q&A: Response to ns_java problem

Collapse
Posted by Dan Wickstrom on
I've changed ns_java significantly since I ported webmail, and the command interface no longer supports the original ns_java command. To emulate the old command using nsjava version 1.0.0 or greater, add the something like the following (untested) in webmail-defs.tcl

if ![string length [info commands ns_java]] {
    proc ns_java { args } {
        set i 0
        if [string equal [lindex $args 0] -detach] {
            incr i
        }
        foreach {class dummy method} [split [lindex $args $i] ::] break
        set size [expr [llength $args] - $i - 1]
        set iargs [nsjava::new {String[]} $size]
        for {incr i} {$i < [llength $args]} {incr i} {
            $iargs set $i [lindex $args $i]
        }
        nsjava::call $class [list $method {String[]}] $iargs
    }
}

I will add this into the 3.2.x sources.