GCJ's URLClassloader and 'core' protocol

Sal gcj@svf.dreamhost.com
Mon Jun 28 15:20:00 GMT 2004


Andrew Haley wrote:
> Sal writes:
>  > Andrew Haley wrote:
>  > > Sal writes:
>  > >  > I've read the docs and looked into the code for URLClassloader and the 
>  > >  > 'core' protocol, but am still unable to figure out how to get it to work 
>  > >  > properly. Some help would be greatly appreciated.
>  > > For loading classes you should used the "gcjlib" protocol.
>  > 
>  > I tried this protocol also... without any success.  Does it work for 
>  > statically linked classes? From what I could gather from the source 
>  > code, it only will load resources from .so/shared objects.
> 
> You want to load statically compiled classes that are already linked
> into an executable, but into a different class loader context?

Yes, is this currently possible?

> 
>  > I'de like to keep all my classes linked into a self contained
>  > executable if possible... though I think the ability to do both is
>  > important.
>  > 
>  > > You should be able to load resources from shared libraries too.
>  > 
>  > Resources as in, images/.class files?
> 
> Class files are compiled when placed into a .so, other resources are
> just copied.

Can a compiled class be loaded from a .so from within a custom 
classloader context?  It seems to work fine when the primordial/system 
classloader gets the request but from within a custom classloader I 
can't seem to get it to work.

I'm mostly concerned with getting statically compiled/linked classes to 
load from an application's own executable... but I'll likely be working 
with .so in the future.

If you can point me to any code snippits that would be great... if this 
is at all possible.  I tried to find some examples using the 
URLClassloader 'core' protocol but had no luck.  Do you have any idea 
what it was implemented for in the first place?  I'm wondering if the 
creator used it for loading objects... or just pulling out images/etc.

- Sal



More information about the Java mailing list