avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hammant <Paul_Hamm...@yahoo.com>
Subject Re: Classloader thoughts?
Date Tue, 06 Nov 2001 09:35:13 GMT
Serge,

>
>In theory all the jars in blocks/ and lib/ directory should be loaded via the 
>same ClassLoader (However we experimented with a few things re ClassLoader a 
>bit back so that may have caused issues). So in theory you should be able to 
>do something like the following. 
>
>BlockContext context = ...;
>File homeDir = context.getHomeDirectory();
>File classesDir = new File( homeDir, "classes" );
>URL[] urls = new URL[] { classesDir.toURL() };
>
>ClassLoader parent = James.class.getClassLoader();
>
>URLClassLoader classloader = URLClassLoader.newInstance( urls, parent );
>
>then in theory you should be able to load mailets/matchers out of this 
>classloader. You should also be able to throw it away later and reload it all 
>providing that all matchers/mailets are in classes/ directory.
>
I can vouch for this as it works for Jesktop like this.  It you are 
using Fede's Store then you'll have to be careful with the classloader 
there too.

- Paul


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message