[MISC] [MOBY-dev] Java developers, let's talk together

Andrew D. Farmer adf at ncgr.org
Thu Sep 16 23:46:52 UTC 2004


>    And I will continue, especially with the most important topic, pointed
> out by Paul G., how to make sure that users of Java libraries always know
> what put on their claspath when they use several libraries from several
> authors. I have to sleep on that... (because put everything
> third-party libs into one shared directory can lead to the versioning
> problem).

I missed this in the original message, but it happened to catch my eye here.
FWIW, we had a similar problem in ISYS, where independent components each 
came with their own set of classes (possibly different versions of the same 
libs) and the system itself had its own set. 

The solution we used involved custom classloaders (which I have since read 
officially qualifies one as a master of black magic); if I recall correctly, 
you can actually have multiple versions of the "same" class loaded into one 
VM, provided that they are loaded by different classloaders. Each class 
(version) maintains a reference to the classloader that loaded it, and the 
latter is given the first chance at loading classes referenced by the former 
or delegating to another classloader to find it. It is a bit complicated, 
but designed for situations like this.  
It does require that some mechanism other than the system classpath be used
for specifying the location of the resources for each classloader; in our
case, each component had its own directory space and the custom classloaders
just searched the lib directory of that component for jars (or it could be
done as a config file).

Your situation may not call for measures this complicated, but let me know
if you want any more information on our experience with this approach...

Andrew

> 
> > You should perhaps work out with him directly where they fit best, and
> > we can make the changes and re-commit.
> >
>    Yes, we are in touch...
> 
>    Regards,
>    Martin
> 
> 

-- 

Andrew Farmer
adf at ncgr.org
(505) 995-4464
Database Administrator/Software Developer
National Center for Genome Resources

---
The whole problem with the world is that fools and fanatics are always
so certain of themselves, and wiser people so full of doubts. -
Bertrand Russell
---





More information about the MOBY-dev mailing list