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

Just read that article further… the instantiation syntax isn’t particularly nice in Groovy though as you need to do eg:

jaxbContext = Class.forName(‘javax.xml.bind.JAXBContext’).newInstance()

whereas in jython this would be:

import javax.xml.bind.JAXBContext
jaxbContext = javax.xml.bind.JAXBContext()

The article also claims Groovy can’t subclass classes imported from external libraries when loaded at runtime this way (but this may be old as the article is from February 2007).

You definitely can do this in jython though and is most useful – the standard syntax works:

class MySubclass(javax.xml.bind.JAXBContext):
pass

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