Hi
In my sdk plug-in resouce folder I have created a folder called "Lib" (at the same level as that Icons) underwhich I have placed a tcl library. I want to load this package at runtime in open request handler, how can I achive this.
I am currently doing it as follows but some how not convinced that it is the right way, please let me know.
URL installURL = Platform.getBundle("myplugin").getEntry("/");
URL url = null;
try {
url = new URL(installURL, "Lib/myTool.tcl");
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
InputStream stream = null;
try {
stream = url.openStream();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (stream == null)
logMessage(model, IssueSeverity.ERROR, "myTool.tcl failed loading", requestResponse);
String byteString = new String();
byte[] b = new byte[100];
int count = 0;
try {
while ((count = stream.read(b, 0,100)) > 0 )
{
byteString = byteString + new String(b,0,count);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tclInterpreter.execute(byteString);
tclInterpreter.execute("package require Network"); // I guess this may not be required.
Regards
anadgoud