title: Custom class loader in Constructor.newInstance
body: <p>I'm using rhino via the bean scripting framework to create and configure objects in my java process. Some of the classes used in the scripts need to be loaded dynamically as they won't always be on the standard classpath.</p>
  
  <p>To load these classes I initialize the scripting framework's context factory with a custom class loader that loads these classes from an auxilary directory. This works well.</p>
  
  <p>The problem is that some of these classes, in their constructors, use other classs which must also be loaded from this auxilary directory. Looking at the source I see that the javascript engine is simply calling Constructor.newInstance.</p>
  
  <p>How do I know which classloader the newInstance call uses, and can I inject my own so I can manually load classes that the standard class loader doesn't know how to load.</p>