Thread: [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 |
From: <ni...@ma...> - 2007-03-19 10:45:49
|
Hi, Your error is that the starkit package is not found. This is part of the vfs package, which is shipped with tcl8.4... I dont know how ones uses tcl packages from jacl, as I'm a new tclblend user.. but it seems you are currently sourcing tcl scripts (unwrapped), and not starkits, which is what the starkit package is required for. You might want to bypass this if you are not planning on using starkits. regards, nikos > 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 > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________ > tcljava-user mailing list > tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcljava-user > |
From: Mo D. <mo...@mo...> - 2007-04-06 19:37:44
|
Richard Shaw wrote: > 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... > > 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. I can only conclude that you are trying to run your Tcl application that loads the starkit package inside Jacl. That is not going to work since Jacl does not include support for the starkit extension. You will need to use Tcl Blend to load native C extensions inside the JVM. Mo |