Hi
I am very new to JACL and TCL itself.
My aim is to be able to call a TCL Script in a Java Program. I have figured
out that I use the tcl.lang.Interp class to create a new instance of the
jacl interpreter and use its eval method to evaluate any of the tcl commands
But I want to execute a tcl script from the new interpreter.
Something equivalent to the Tcl_EvalFile(Interp interp, String filename)
that is available with the C version of TCL.
I find there is a command interp.evalFile(String filename). But this is
throwing an error 
tcl.lang.TclException
        at tcl.lang.ReturnCmd.cmdProc(ReturnCmd.java, Compiled Code)
        at tcl.lang.Parser.evalObjv(Parser.java, Compiled Code)
        at tcl.lang.Parser.eval2(Parser.java, Compiled Code)
        at tcl.lang.Procedure.cmdProc(Procedure.java)
        at tcl.lang.Parser.evalObjv(Parser.java, Compiled Code)
        at tcl.lang.Parser.evalObjv(Parser.java, Compiled Code)
        at tcl.lang.Parser.eval2(Parser.java, Compiled Code)
        at tcl.lang.Interp.eval(Interp.java)
        at tcl.lang.Interp.eval(Interp.java)
        at CallTcl.evalScript(CallTcl.java:9)
        at CallTcl.main(CallTcl.java:17)

The program I have written is:
public class CallTcl {
        
        Interp interp = new Interp();
        
        public String evalScript(String s) throws TclException {
                interp.eval(s);
                return interp.getResult().toString();
        }
        
        public static void main(String args[]) throws Exception{
                CallTcl callTcl = new CallTcl();
                try {
                        callTcl.evalScript("tgrep.tcl");
                } catch (TclException te) {
                        te.printStackTrace();
                }
                callTcl.interp.dispose();
        }
}

CAN anyone help me with this? 

In short, I need to know how to pass a tcl script to a java program and run
it? I may have parameters too that have to be pass to that tcl file
executable.

Thanking in advance
Sai

Sai Geetha M N
Web Technologist
Planetasia Research Lab
Planetasia Ltd.

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to