[tcljava-user] evalFile & package require: How to execute a tcl file that starts a tcl based app?
Brought to you by:
mdejong
From: Richard S. <arc...@gm...> - 2007-03-18 23:06:33
|
Hello, I am trying to run a tcl script that then runs a tcl script application. This is normally done by calling main.tcl and the wish84.exe in the Tcl Interpreter /bin directory via a desktop shortcut. main.tcl then calls another file which calls several more... I am now attempting to perform a similar operation (running the app) by calling main.tcl using evalFile. However when I run the program I get the error: "can't find package starkit". I have tried placing the java file(s) which invoke this in several directories, including the one where main.tcl is located and the 'start-in' location pointed to in the desktop shortcut(s). This is the main.tcl file: ================= package require starkit starkit::startup package require app-start ============== The callStapTk() java method: ==================== public void callStapTk() { Interp callingStap = new Interp(); try { callingStap.evalFile(defaultStapLoc); /* String defaultStapLoc = "C:\\dissproject\\starkits\\staptk.vfs\\main.tcl"; */ System.out.println("Running default StapTk..."); } catch (TclException ex) { int code = ex.getCompletionCode(); switch (code) { case TCL.ERROR: System.err.println(callingStap.getResult().toString()); break; case TCL.BREAK: System.err.println( "invoked \"break\" outside of a loop"); break; case TCL.CONTINUE: System.err.println( "invoked \"continue\" outside of a loop"); break; default: System.err.println( "command returned bad error code: " + code); break; } } finally { callingStap.dispose(); } } =================== The Desktop Shortcut properties: Target Type: Application Target location: bin Target: C:\Tcl\bin\wish84.exe C:\dissproject\starkits\staptk.vfs\main.tcl Start In: C:\dissproject\STAPTK-INSTALL ================== This is the same file that is called in the shortcut, which has no problem finding packages. Do I have to modify the evalFile call? The whole purpose of this exercise is to remove the need for a seperate Tcl interpreter installation by using the one within Jacl. Any help, advice, code, much appreciated. Richard |