This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
GCJ's URLClassloader and 'core' protocol
- From: Sal <gcj at svf dot dreamhost dot com>
- To: java at gcc dot gnu dot org
- Date: Thu, 24 Jun 2004 15:14:08 -0400
- Subject: GCJ's URLClassloader and 'core' protocol
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.
What I'm trying to to: Load a natively compiled, and statically linked
class from within a custom classloader... this is being done to restrict
permissions granted to that class in a way that conforms to Java's
security model. The only way I've seen to get to statically linked
resources is from the 'core' protocol via URLClassloader.
I'm doing this:
URLClassLoader ucl = null;
try
{
ucl = new URLClassLoader(new URL[] {new URL("core", "", -1, "/")});
}
catch (Exception e)
{
System.out.println("error initing classloader");
}
try
{
Test2 t2 = (Test2) ucl.loadClass("Test2").newInstance();
}
catch (Exception e)
{
System.out.println("class not found");
}
I always recieve the 'class not found' error. I've tried different
types and values for the 'core' URL object constructor (different paths,
etc.) but nothing seems to grab the native object.
One reason may be that core will only load resources (ie images, etc.),
and not classes that are statically linked? I did look into the GCJ
source code to try and figure out what is going on, but I'm still to new
to GCJ to make much sense out of it. If someone with more knowledge
could help me out that would be greatly appreciated.
If this is not currently possible, I would like to volunteer to
implement it. So any direction/advice there would be welcome too.
Thanks in advance,
- Sal