classpath precedence issue

Is there a way to make my beanshell scripts give jars in lib/ext preference over those in lib itself? I'm trying to use a customized version of a class already in a jar in lib, and the classloader won't see the one in lib/ext.

Thanks :)

No

Sorry, there's no means to do that right now. What class are you working with, though? Is there something we might benefit from updating?

it's a customized, internal

it's a customized, internal version of htmlunit, based on 2.9-snapshot, but I could probably backport our customizations to htmlunit-2.8 (the latest GA release).

From what I've been reading, if the Interpreter or the BshClassManager were exposed to interpreted java scripts, I could change the classloader behavior to load the classes from a specific jar. The way I would do this would be to bind the Interpreter or the BshClassmanager before calling exec() on the Interpreter, but that's in the application's code.

Here is an excerpt from the beanshell documentation that I'm referring to:

The bsh.Interpeter setClassLoader() and bsh.BshClassManager.setClassLoader() methods can be used to set an external class loader which is consulted for all basic class loading in BeanShell.

BeanShell will use the specified class loader at the same point where it would otherwise use the plain Class.forName(). If no explicit classpath management is done from the script (addClassPath(), setClassPath(), reloadClasses()) then BeanShell will only use the supplied classloader. If additional classpath management is done then BeanShell will perform that in addition to the supplied external classloader. However BeanShell is not currently able to reload classes supplied through the external classloader.