Hi! Thanks for the responses!
Reply to Martijn: Yes: it DOES work when i have the right location in the CLASSPATH (which is great), but what i'm attempting to do is handle both versions in my code (and future cases that use the same "lookup" mechanism, as well). I'm not sure if that was clear: I have application A, which uses jar Library Z from application B, which I don't maintain or control. Application B has changed over time, as application (B1), with jar Library (Z1) which has the same signatures and different implementations. I want my application A to work with Z and Z1. I have a mechanism for FINDING the right jar in the installation (properties files in known locations), and I have a guarantee that the signatures have not and will not change.
Reply to Ulf: I think this may be my issue (loading by more than one classloader). The follow-on question i have is -- do i need to explicitly use the classloader to which i've added the URLs of the jar whenever i even MENTION a class in this jar --
For example, in that method i posted, another class has a member variable that is a NavstackPacket. It gets "set up" by this method, so that there's a line like
NavstackPacket outbound = getNewNavstackPacket( thepayload );
so, maybe i should pass the thing back as an OBJECT and then use the classloader to load the class and then CAST the result of getNewNavstackPacket() to the class?
Something like that?
If you have advice about where I can read up on the "standard approaches" to doing this kind of thing, that would also be GREAT -- I bet that there are lots of places in my code where I need to do a little trick like this one, and it'd be better to be doing the "recommended" little trick, if possible
Thanks again!!!
--Corey