VMClassLoader.java [plain text]
package gnu.gcj.runtime;
import java.io.*;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.net.URL;
public final class VMClassLoader extends java.net.URLClassLoader
{
private VMClassLoader ()
{
super (new URL[0]);
String p
= System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control",
"");
if ("never".equals(p))
lib_control = LIB_NEVER;
else if ("cache".equals(p))
lib_control = LIB_CACHE;
else if ("full".equals(p))
{
lib_control = LIB_FULL;
}
else
lib_control = LIB_FULL;
}
private void init()
{
StringTokenizer st
= new StringTokenizer (System.getProperty ("java.class.path", "."),
System.getProperty ("path.separator", ":"));
while (st.hasMoreElements ())
{
String e = st.nextToken ();
try
{
if (!e.endsWith (File.separator) && new File (e).isDirectory ())
addURL(new URL("file", "", -1, e + File.separator));
else
addURL(new URL("file", "", -1, e));
}
catch (java.net.MalformedURLException x)
{
}
}
try
{
addURL(new URL("core", "", -1, "/"));
}
catch (java.net.MalformedURLException x)
{
}
}
protected native Class findClass(String name)
throws java.lang.ClassNotFoundException;
static void initialize ()
{
instance.init();
}
private HashSet tried_libraries = new HashSet();
private int lib_control;
static VMClassLoader instance = new VMClassLoader();
private static final int LIB_FULL = 0;
private static final int LIB_CACHE = 1;
private static final int LIB_NEVER = 2;
}