bugtests.test338cl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython-standalone Show documentation
Show all versions of jython-standalone Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
import java.io.*;
public class test338cl extends ClassLoader {
protected Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
//System.out.println("MyLoadClass " + name);
Class c = findLoadedClass(name);
if (c != null)
return c;
try {
FileInputStream fis = new FileInputStream(name.replace('.', '/') + ".class");
int size = fis.available();
byte[] buf = new byte[size];
fis.read(buf);
fis.close();
c = defineClass(name, buf, 0, buf.length);
if (resolve)
resolveClass(c);
return c;
} catch (IOException exc) {
return super.loadClass(name, resolve);
}
}
}