Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

How do I load jars and classes dynamically at runtime?

Use the groovy script's classLoader to add the jar file at runtime.

this.class.classLoader.rootLoader.addURL(new URL("file:///path to file"))

Then, use Class.forName to load the class.

def cls = Class.forName("com.mysql.jdbc.Driver").newInstance();

  • No labels