> > ...The reason I need to hold on to the bundle is to load classes using > > that its classloader at a later point in time... > > Can't you do that using getClass().getClassLoader() on a class that's inside > that bundle? > > I *think* keeping references to Bundle objects is fine if you track them with > a BundleTracker, but that sounds somewhat complicated.
I actually need to load a class using the classloader from a different bundle (B2) than the current one (B1). At some point in time B1 might be called on to load a class from B2 so the only way I knew how to do this was to use bundle references and Bundle.getClass(). Yes, it's done to appease a legacy bundle which is not OSGi-friendly :| . Robert