[tcljava-user] Help Required on Loading packages in tcljava
Brought to you by:
mdejong
From: shrisha k. <nav...@gm...> - 2007-05-09 07:24:20
|
Hello All, Recently i am involved in new project which required to implement the certain function using java and tcl.During this i faced some problem in the code. My problem was not able to load the package from java. i do hava a tcl script like this ========================= package require IxTclHal package require params source "$params::libdir/alarms.tcl" #----------------------------------------------------------- # e.g. set portList [list [list 1 4 1] [list 1 4 2]] #----------------------------------------------------------- proc initIxia { portList } { set host 192.168.3.126 set username "TCAS User" if [isUNIX] { if [ixConnectToTclServer $host] { ixPuts "Could not connect to $host" return 1 } } # Now connect to the chassis if [ixConnectToChassis $host] { ixPuts $::ixErrorInfo return 1 } # Get the chassis ID to use in port lists set chas [ixGetChassisID $host] set num [llength $portList] for {set i 0} {$i<$num} {incr i 1} { set Port($i) [lindex $portList $ ============================= And my java code is like this ======================== * import * tcl.lang.*; * public * *class* Ixia *implements* Testset{ *public* *void* initIxia() { Interp interp= *new* Interp(); String scriptFileName="c:\\TCAS\\cgi-bin\\lib\\ethr.tcl"; ** *try* { interp.setVar( "host",TclString.*newInstance*("192.168.3.100 "),0); interp.eval*File(* *"ScriptFileName*"); } *catch*(Exception e){System.*out*.println(e); } } ========================= when i run this code it gives me the exception like this ================ * tcl.lang.TclException *: can't find package IxTclHal ================= Basically i want to know how to load tcl script and i turn will have package file.Where should i put these package file. But i run "Package require IxTclHal" from tcl prompt it is loading the package.But throug the java program it is not working. Please help me it is needed very urgent Thanks Shrisha |