title: Dynamic load of fat jar's
body: <p>Using something like one-jar or sbt-assembly, what is the correct way to dynamically load a class from a fat jar?  Single jar example:</p>
  
  <pre><code>val loader = new  URLClassLoader(Array(new File(jarName).toURI.toURL), this.getClass().getClassLoader())
  var classToLoad = Class.forName (pluginName, true, loader)
  var method = classToLoad.getDeclaredMethod (methodName)
  var instance = classToLoad.newInstance ()
  var result = method.invoke (instance)
  Console.println("Result: " + result)
  </code></pre>
  
  <p>This works fine for my package made jar, but if I create it via one-jar or assembly, it gets a  <code>java.lang.ClassNotFoundException</code> exception.  Do I need a custom class loader (and if so, where is it?) Or is there a special syntax needed on the class or package name?</p>
  
  <p>Thanks!</p>
  
  <p>-Greg</p>
  
  <p>(Example in Scala, but more than happy with a Java example!)</p>