Manage groovy dependencies in Java -
i'm working on java motor run groovy scripts, want load dependencies needed run groovy script. @ moment, i'm loading jars bellow :
file file = new file(elem); url url = file.touri().tourl(); url[] urls = new url[] { url }; @suppresswarnings("resource") classloader cl = new urlclassloader(urls); try { cl.loadclass("com.example.scriptlibrary"); return cl; } catch (classnotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); throw new malformedurlexception("[error] : bad library path\n"); }
it works code loads jar libraries. wanted know if there other way groovy dependencies or can , load jars java code.
Comments
Post a Comment