Adding external libraries

9.42K viewsScripting
0

Since Groovy easily allows external Java libraries to be accessed, I assume that can also be done from within Quantrix scripts – but what does one need to do about setting path variables and such like. I’m sure I could figure it out by a process of elimination, but it would be much easier if someone else has already done it :) And an example of using an Import statement within a Script would be just perfect…

Thanks

Simon

0

This shouldn’t be too difficult as I have been doing this for years with my Jython plug-in. To add to the runtime classpath all I do is:

sys.path.append(jarfile)

where jarfile is a string and then I can import the libraries.

For Groovy, a quick search turns up [url:35b3kppj]http://groovy.codehaus.org/Influencing+class+loading+at+runtime[/url:35b3kppj] which seems to indicate you do something along the lines of:

this.class.classLoader.rootLoader.addURL(jarfile.toURI().toURL())

where jarfile is a File.

You are viewing 1 out of 15 answers, click here to view all answers.